|
1 | 1 | error[E0277]: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely |
2 | | - --> $DIR/send-not-implemented.rs:6:1 |
3 | | - | |
4 | | -6 | #[async_trait] |
5 | | - | ^^^^^^^^^^^^^^ `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely |
6 | | - | |
7 | | - = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>` |
8 | | - = note: required because it appears within the type `for<'r, 's> {&'r Self, std::sync::Mutex<()>, std::sync::MutexGuard<'s, ()>, impl std::future::Future, impl std::future::Future, ()}` |
9 | | - = note: required because it appears within the type `[static generator@$DIR/tests/ui/send-not-implemented.rs:8:26: 12:6 _self:&Self for<'r, 's> {&'r Self, std::sync::Mutex<()>, std::sync::MutexGuard<'s, ()>, impl std::future::Future, impl std::future::Future, ()}]` |
10 | | - = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/tests/ui/send-not-implemented.rs:8:26: 12:6 _self:&Self for<'r, 's> {&'r Self, std::sync::Mutex<()>, std::sync::MutexGuard<'s, ()>, impl std::future::Future, impl std::future::Future, ()}]>` |
11 | | - = note: required because it appears within the type `impl std::future::Future` |
12 | | - = note: required because it appears within the type `impl std::future::Future` |
13 | | - = note: required for the cast to the object type `dyn std::future::Future<Output = ()> + std::marker::Send` |
| 2 | + --> $DIR/send-not-implemented.rs:8:26 |
| 3 | + | |
| 4 | +8 | async fn test(&self) { |
| 5 | + | __________________________^ |
| 6 | +9 | | let mutex = Mutex::new(()); |
| 7 | +10 | | let _guard = mutex.lock().unwrap(); |
| 8 | +11 | | f().await; |
| 9 | +12 | | } |
| 10 | + | |_____^ `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely |
| 11 | + | |
| 12 | + = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>` |
| 13 | + = note: required because it appears within the type `for<'r, 's> {&'r Self, std::sync::Mutex<()>, std::sync::MutexGuard<'s, ()>, impl std::future::Future, impl std::future::Future, ()}` |
| 14 | + = note: required because it appears within the type `[static generator@$DIR/tests/ui/send-not-implemented.rs:8:26: 12:6 _self:&Self for<'r, 's> {&'r Self, std::sync::Mutex<()>, std::sync::MutexGuard<'s, ()>, impl std::future::Future, impl std::future::Future, ()}]` |
| 15 | + = note: required because it appears within the type `std::future::GenFuture<[static generator@$DIR/tests/ui/send-not-implemented.rs:8:26: 12:6 _self:&Self for<'r, 's> {&'r Self, std::sync::Mutex<()>, std::sync::MutexGuard<'s, ()>, impl std::future::Future, impl std::future::Future, ()}]>` |
| 16 | + = note: required because it appears within the type `impl std::future::Future` |
| 17 | + = note: required because it appears within the type `impl std::future::Future` |
| 18 | + = note: required for the cast to the object type `dyn std::future::Future<Output = ()> + std::marker::Send` |
0 commit comments