-
-
Save nikomatsakis/ac95488236dec61976c92e523df622f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0277]: `std::sync::MutexGuard<'_, u32>` cannot be sent between threads safely | |
--> src/main.rs:23:5 | |
| | |
23 | is_send(foo()); | |
| ^^^^^^^ `std::sync::MutexGuard<'_, u32>` cannot be sent between threads safely | |
| | |
note: in the suspended state from calling `foo`: | |
| async fn foo() { | |
| --- the future that results from calling foo... | |
NN | bar(&Mutex::new(22)).await; | |
| ^^^ may suspend while calling bar | |
note: in the suspended state from calling `bar`: | |
| async fn bar() { | |
| --- the future that results from calling bar... | |
NN | let g = x.lock().unwrap(); | |
| ^ may suspend with `g`, a `MutexGuard` on the stack | |
note: required by `is_send` | |
--> src/main.rs:5:1 | |
| | |
5 | fn is_send<T: Send>(t: T) { | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0277]: `std::sync::MutexGuard<'_, u32>` cannot be sent between threads safely | |
--> src/main.rs:23:5 | |
| | |
23 | is_send(foo()); | |
| ^^^^^^^ `std::sync::MutexGuard<'_, u32>` cannot be sent between threads safely | |
| | |
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, u32>` | |
= note: required because it appears within the type `for<'r, 's> {&'r std::sync::Mutex<u32>, std::sync::MutexGuard<'s, u32>, impl std::future::Future, ()}` | |
= note: required because it appears within the type `[static generator@src/main.rs:13:30: 16:2 x:&std::sync::Mutex<u32> for<'r, 's> {&'r std::sync::Mutex<u32>, std::sync::MutexGuard<'s, u32>, impl std::future::Future, ()}]` | |
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:13:30: 16:2 x:&std::sync::Mutex<u32> for<'r, 's> {&'r std::sync::Mutex<u32>, std::sync::MutexGuard<'s, u32>, impl std::future::Future, ()}]>` | |
= note: required because it appears within the type `impl std::future::Future` | |
= note: required because it appears within the type `impl std::future::Future` | |
= note: required because it appears within the type `for<'r> {impl std::future::Future, ()}` | |
= note: required because it appears within the type `[static generator@src/main.rs:9:16: 11:2 for<'r> {impl std::future::Future, ()}]` | |
= note: required because it appears within the type `std::future::GenFuture<[static generator@src/main.rs:9:16: 11:2 for<'r> {impl std::future::Future, ()}]>` | |
= note: required because it appears within the type `impl std::future::Future` | |
= note: required because it appears within the type `impl std::future::Future` | |
note: required by `is_send` | |
--> src/main.rs:5:1 | |
| | |
5 | fn is_send<T: Send>(t: T) { | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment