File tree 3 files changed +36
-6
lines changed
3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 1
1
error: 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
3
3
|
4
4
LL | pub fn foo() -> impl Future + Send {
5
5
| ^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
6
6
|
7
7
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
8
8
note: 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
10
10
|
11
11
LL | match client.status() {
12
12
| ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL | let _x = get().await;
17
17
LL | }
18
18
| - `client` is later dropped here
19
19
help: 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
21
21
|
22
22
LL | match client.status() {
23
23
| ^^^^^^^^^^^^^^^
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 1
1
// 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
2
6
use std:: any:: Any ;
3
7
use std:: future:: Future ;
4
8
@@ -10,16 +14,16 @@ impl Client {
10
14
}
11
15
}
12
16
13
- async fn get ( ) { }
17
+ async fn get ( ) { }
14
18
15
19
pub 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
17
21
let client = Client ( Box :: new ( true ) ) ;
18
22
async move {
19
23
match client. status ( ) {
20
24
200 => {
21
25
let _x = get ( ) . await ;
22
- } ,
26
+ }
23
27
_ => ( ) ,
24
28
}
25
29
}
You can’t perform that action at this time.
0 commit comments