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

error: future cannot be sent between threads safely
  --> tests/ui/send-not-implemented.rs:14:38
   |
14 |       async fn test_ret(&self) -> bool {
   |  ______________________________________^
15 | |         let mutex = Mutex::new(());
16 | |         let _guard = mutex.lock().unwrap();
17 | |         f().await;
18 | |         true
19 | |     }
   | |_____^ future created by async block is not `Send`
   |
   = help: within `[async block@$DIR/tests/ui/send-not-implemented.rs:14:38: 19:6]`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
note: future is not `Send` as this value is used across an await
  --> tests/ui/send-not-implemented.rs:17:12
   |
16 |         let _guard = mutex.lock().unwrap();
   |             ------ has type `MutexGuard<'_, ()>` which is not `Send`
17 |         f().await;
   |            ^^^^^^ await occurs here, with `_guard` maybe used later
18 |         true
19 |     }
   |     - `_guard` is later dropped here
   = 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`