Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests fail with --no-default-features #71

Open
jonassmedegaard opened this issue Aug 8, 2023 · 1 comment
Open

tests fail with --no-default-features #71

jonassmedegaard opened this issue Aug 8, 2023 · 1 comment

Comments

@jonassmedegaard
Copy link

Building and testing with option --no-default-features fails like this:

81s   --> src/events.rs:14:5
 81s    |
 81s 14 | use tokio::sync::mpsc;
 81s    |     ^^^^^ use of undeclared crate or module `tokio`
 81s 
 81s error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
 81s   --> src/reader.rs:14:5
 81s    |
 81s 14 | use tokio::fs::{metadata, File};
 81s    |     ^^^^^ use of undeclared crate or module `tokio`
 81s 
 81s error[E0433]: failed to resolve: use of undeclared crate or module `tokio`
 81s   --> src/reader.rs:15:5
 81s    |
 81s 15 | use tokio::io::{AsyncBufReadExt, AsyncSeekExt, BufReader, Lines};
 81s    |     ^^^^^ use of undeclared crate or module `tokio`
 81s 
 81s error[E0599]: no method named `poll_next_line` found for struct `Pin<_>` in the current scope
 81s    --> src/reader.rs:270:63
 81s     |
 81s 270 | ...                   let res = ready!(Pin::new(reader).poll_next_line(cx));
 81s     |                                                         ^^^^^^^^^^^^^^ method not found in `Pin<_>`
 81s 
 81s error[E0277]: the size for values of type `dyn futures_util::Future<Output = Result<std::fs::Metadata, std::io::Error>> + Send + Sync` cannot be known at compilation time
 81s    --> src/reader.rs:484:53
 81s     |
 81s 484 |                         let metadata_fut = Box::pin(metadata(path.clone()));
 81s     |                                            -------- ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
 81s     |                                            |
 81s     |                                            required by a bound introduced by this call
 81s     |
 81s     = help: the trait `Sized` is not implemented for `dyn futures_util::Future<Output = Result<std::fs::Metadata, std::io::Error>> + Send + Sync`
 81s note: required by a bound in `Box::<T>::pin`
 81s 
 81s Some errors have detailed explanations: E0277, E0433, E0599.
 81s For more information about an error, try `rustc --explain E0277`.
 81s error: could not compile `linemux` due to 5 previous errors
@jmagnuson
Copy link
Owner

Thanks for the report. It's somewhat moot right now since tokio is currently the only supported runtime, but this error is due to the overall desire to support other runtimes like async-std, and cargo's inability to declare that exactly one feature of a set is enabled at build time (likely rust-lang/cargo#2980).

Looking at how sqlx handles this, they expose various facades which panic on execution if no runtime is set (example). That may be a specific design decision, since it should be possible to fail at compile time via compile_error!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants