File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 11error: future cannot be sent between threads safely
2- --> $DIR/issue-64130-4-async-move.rs:15 :17
2+ --> $DIR/issue-64130-4-async-move.rs:19 :17
33 |
44LL | pub fn foo() -> impl Future + Send {
55 | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
66 |
77 = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
88note: future is not `Send` as this value is used across an await
9- --> $DIR/issue-64130-4-async-move.rs:21 :31
9+ --> $DIR/issue-64130-4-async-move.rs:25 :31
1010 |
1111LL | match client.status() {
1212 | ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL | let _x = get().await;
1717LL | }
1818 | - `client` is later dropped here
1919help: consider moving this into a `let` binding to create a shorter lived borrow
20- --> $DIR/issue-64130-4-async-move.rs:19 :15
20+ --> $DIR/issue-64130-4-async-move.rs:23 :15
2121 |
2222LL | match client.status() {
2323 | ^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change 1+ error: future cannot be sent between threads safely
2+ --> $DIR/issue-64130-4-async-move.rs:19:17
3+ |
4+ LL | pub fn foo() -> impl Future + Send {
5+ | ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
6+ |
7+ = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
8+ note: future is not `Send` as this value is used across an await
9+ --> $DIR/issue-64130-4-async-move.rs:25:31
10+ |
11+ LL | match client.status() {
12+ | ------ has type `&Client` which is not `Send`
13+ LL | 200 => {
14+ LL | let _x = get().await;
15+ | ^^^^^^ await occurs here, with `client` maybe used later
16+ ...
17+ LL | }
18+ | - `client` is later dropped here
19+ help: consider moving this into a `let` binding to create a shorter lived borrow
20+ --> $DIR/issue-64130-4-async-move.rs:23:15
21+ |
22+ LL | match client.status() {
23+ | ^^^^^^^^^^^^^^^
24+
25+ error: aborting due to previous error
26+
Original file line number Diff line number Diff line change 11// edition:2018
2+ // revisions: no_drop_tracking drop_tracking
3+ // [drop_tracking] check-pass
4+ // [drop_tracking] compile-flags: -Zdrop-tracking=yes
5+ // [no_drop_tracking] compile-flags: -Zdrop-tracking=no
26use std:: any:: Any ;
37use std:: future:: Future ;
48
@@ -10,16 +14,16 @@ impl Client {
1014 }
1115}
1216
13- async fn get ( ) { }
17+ async fn get ( ) { }
1418
1519pub fn foo ( ) -> impl Future + Send {
16- //~^ ERROR future cannot be sent between threads safely
20+ //[no_drop_tracking] ~^ ERROR future cannot be sent between threads safely
1721 let client = Client ( Box :: new ( true ) ) ;
1822 async move {
1923 match client. status ( ) {
2024 200 => {
2125 let _x = get ( ) . await ;
22- } ,
26+ }
2327 _ => ( ) ,
2428 }
2529 }
You can’t perform that action at this time.
0 commit comments