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

Compilation fails for wasm-bindgen and async-std #65

Open
wackazong opened this issue Mar 16, 2023 · 0 comments
Open

Compilation fails for wasm-bindgen and async-std #65

wackazong opened this issue Mar 16, 2023 · 0 comments

Comments

@wackazong
Copy link

I use the crate with wasm-bindgen and async-std and it fails to compile with the following errors.

error: future cannot be sent between threads safely
   --> /Users/ander/.cargo/registry/src/github.com-1ecc6299db9ec823/backoff-0.4.0/src/future.rs:237:9
    |
237 |         Box::pin(::async_std_1::task::sleep(dur))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future is not `Send`
    |
    = help: within `impl Future<Output = ()>`, the trait `std::marker::Send` is not implemented for `*mut u8`
note: future is not `Send` as this value is used across an await
   --> /Users/ander/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.12.0/src/io/timeout.rs:43:5
    |
40  |         timeout: timer_after(dur),
    |                  ---------------- has type `async_std::utils::timer::Timer` which is not `Send`
...
43  |     .await
    |     ^^^^^^ await occurs here, with `timer_after(dur)` maybe used later
44  | }
    | - `timer_after(dur)` is later dropped here
    = note: required for the cast from `impl Future<Output = ()>` to the object type `dyn Future<Output = ()> + std::marker::Send`

error: future cannot be sent between threads safely
   --> /Users/ander/.cargo/registry/src/github.com-1ecc6299db9ec823/backoff-0.4.0/src/future.rs:237:9
    |
237 |         Box::pin(::async_std_1::task::sleep(dur))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future is not `Send`
    |
    = help: the trait `std::marker::Send` is not implemented for `(dyn FnMut() + 'static)`
note: future is not `Send` as this value is used across an await
   --> /Users/ander/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.12.0/src/io/timeout.rs:43:5
    |
40  |         timeout: timer_after(dur),
    |                  ---------------- has type `async_std::utils::timer::Timer` which is not `Send`
...
43  |     .await
    |     ^^^^^^ await occurs here, with `timer_after(dur)` maybe used later
44  | }
    | - `timer_after(dur)` is later dropped here
    = note: required for the cast from `impl Future<Output = ()>` to the object type `dyn Future<Output = ()> + std::marker::Send`
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

1 participant