You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.9 KiB
48 lines
1.9 KiB
error: future cannot be sent between threads safely
|
|
--> $DIR/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 `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
|
|
note: future is not `Send` as this value is used across an await
|
|
--> $DIR/send-not-implemented.rs:11:9
|
|
|
|
|
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 to the object type `dyn Future<Output = ()> + Send`
|
|
|
|
error: future cannot be sent between threads safely
|
|
--> $DIR/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 `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
|
|
note: future is not `Send` as this value is used across an await
|
|
--> $DIR/send-not-implemented.rs:17:9
|
|
|
|
|
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 to the object type `dyn Future<Output = bool> + Send`
|