blob: 8004de63bdca5584a3ec523f275b5345b551ce0d [file] [log] [blame]
Andrew Walbrand1b91c72020-08-11 17:12:08 +01001error: future cannot be sent between threads safely
David LeGareffb07e72022-03-01 18:48:27 +00002 --> tests/ui/send-not-implemented.rs:8:26
Andrew Walbrand1b91c72020-08-11 17:12:08 +01003 |
48 | async fn test(&self) {
5 | __________________________^
69 | | let mutex = Mutex::new(());
710 | | let _guard = mutex.lock().unwrap();
811 | | f().await;
912 | | }
Joel Galenson5448f372021-04-01 15:10:30 -070010 | |_____^ future created by async block is not `Send`
Andrew Walbrand1b91c72020-08-11 17:12:08 +010011 |
David LeGareffb07e72022-03-01 18:48:27 +000012 = help: within `impl Future<Output = [async output]>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
Andrew Walbrand1b91c72020-08-11 17:12:08 +010013note: future is not `Send` as this value is used across an await
David LeGareffb07e72022-03-01 18:48:27 +000014 --> tests/ui/send-not-implemented.rs:11:9
Andrew Walbrand1b91c72020-08-11 17:12:08 +010015 |
1610 | let _guard = mutex.lock().unwrap();
Chih-Hung Hsiehf8b73ea2020-10-26 13:16:52 -070017 | ------ has type `MutexGuard<'_, ()>` which is not `Send`
Andrew Walbrand1b91c72020-08-11 17:12:08 +01001811 | f().await;
19 | ^^^^^^^^^ await occurs here, with `_guard` maybe used later
2012 | }
21 | - `_guard` is later dropped here
Chih-Hung Hsiehf8b73ea2020-10-26 13:16:52 -070022 = note: required for the cast to the object type `dyn Future<Output = ()> + Send`
Joel Galenson5448f372021-04-01 15:10:30 -070023
24error: future cannot be sent between threads safely
David LeGareffb07e72022-03-01 18:48:27 +000025 --> tests/ui/send-not-implemented.rs:14:38
Joel Galenson5448f372021-04-01 15:10:30 -070026 |
2714 | async fn test_ret(&self) -> bool {
28 | ______________________________________^
2915 | | let mutex = Mutex::new(());
3016 | | let _guard = mutex.lock().unwrap();
3117 | | f().await;
3218 | | true
3319 | | }
34 | |_____^ future created by async block is not `Send`
35 |
David LeGareffb07e72022-03-01 18:48:27 +000036 = help: within `impl Future<Output = [async output]>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
Joel Galenson5448f372021-04-01 15:10:30 -070037note: future is not `Send` as this value is used across an await
David LeGareffb07e72022-03-01 18:48:27 +000038 --> tests/ui/send-not-implemented.rs:17:9
Joel Galenson5448f372021-04-01 15:10:30 -070039 |
4016 | let _guard = mutex.lock().unwrap();
41 | ------ has type `MutexGuard<'_, ()>` which is not `Send`
4217 | f().await;
43 | ^^^^^^^^^ await occurs here, with `_guard` maybe used later
4418 | true
4519 | }
46 | - `_guard` is later dropped here
47 = note: required for the cast to the object type `dyn Future<Output = bool> + Send`