rmanoka / async-scoped

A scope for async_std and tokio to spawn non-static futures
117 stars 14 forks source link

Compile fails when using async-std without the attributes feature enabled #7

Closed KerfuffleV2 closed 3 years ago

KerfuffleV2 commented 3 years ago

The error messages aren't particularly obvious either. For example:

   Compiling async-scoped v0.6.0
error[E0433]: failed to resolve: could not find `test` in `async_std`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/async-scoped-0.6.0/src/tests.rs:5:62
    |
5   |               #[cfg_attr(feature = "use-async-std", async_std::test)]
    |                                                                ^^^^ could not find `test` in `async_std`
...
21  | / test_fixtures! {
22  | |     async fn test_scope() {
23  | |         let not_copy = String::from("hello world!");
24  | |         let not_copy_ref = &not_copy;
...   |
291 | |     }
292 | | }
    | |_- in this macro invocation
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: use of undeclared type `Scope`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/async-scoped-0.6.0/src/tests.rs:26:36
   |
26 |         let (stream, _) = unsafe { Scope::scope(|s| {
   |                                    ^^^^^ not found in this scope
   |
help: consider importing this struct
   |
1  | use crate::Scope;
   |

It seems like the documentation should specify that having attributes enabled for async-std is a requirement. That feature is not turned on by default.

rmanoka commented 3 years ago

Sorry, that's my bad. The latest release includes the test module in the build for no reason. I've fixed it in master; will make a new release shortly.

rmanoka commented 3 years ago

Fixed in v0.6.1.