| 1 |
error: future cannot be sent between threads safely |
| 2 |
--> tests/ui/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 |
| |_____^ future created by async block is not `Send` |
| 11 |
| |
| 12 |
= help: within `[async block@$DIR/tests/ui/send-not-implemented.rs:8:26: 12:6]`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` |
| 13 |
note: future is not `Send` as this value is used across an await |
| 14 |
--> tests/ui/send-not-implemented.rs:11:12 |
| 15 |
| |
| 16 |
10 | let _guard = mutex.lock().unwrap(); |
| 17 |
| ------ has type `MutexGuard<'_, ()>` which is not `Send` |
| 18 |
11 | f().await; |
| 19 |
| ^^^^^^ await occurs here, with `_guard` maybe used later |
| 20 |
12 | } |
| 21 |
| - `_guard` is later dropped here |
| 22 |
= note: required for the cast from `[async block@$DIR/tests/ui/send-not-implemented.rs:8:26: 12:6]` to the object type `dyn Future<Output = ()> + Send` |
| 23 |
|
| 24 |
error: future cannot be sent between threads safely |
| 25 |
--> tests/ui/send-not-implemented.rs:14:38 |
| 26 |
| |
| 27 |
14 | async fn test_ret(&self) -> bool { |
| 28 |
| ______________________________________^ |
| 29 |
15 | | let mutex = Mutex::new(()); |
| 30 |
16 | | let _guard = mutex.lock().unwrap(); |
| 31 |
17 | | f().await; |
| 32 |
18 | | true |
| 33 |
19 | | } |
| 34 |
| |_____^ future created by async block is not `Send` |
| 35 |
| |
| 36 |
= help: within `[async block@$DIR/tests/ui/send-not-implemented.rs:14:38: 19:6]`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` |
| 37 |
note: future is not `Send` as this value is used across an await |
| 38 |
--> tests/ui/send-not-implemented.rs:17:12 |
| 39 |
| |
| 40 |
16 | let _guard = mutex.lock().unwrap(); |
| 41 |
| ------ has type `MutexGuard<'_, ()>` which is not `Send` |
| 42 |
17 | f().await; |
| 43 |
| ^^^^^^ await occurs here, with `_guard` maybe used later |
| 44 |
18 | true |
| 45 |
19 | } |
| 46 |
| - `_guard` is later dropped here |
| 47 |
= note: required for the cast from `[async block@$DIR/tests/ui/send-not-implemented.rs:14:38: 19:6]` to the object type `dyn Future<Output = bool> + Send` |