Skip to content

Commit 777db10

Browse files
committed
Update issue-64130-4-async-move.rs
1 parent 9bcc107 commit 777db10

3 files changed

+36
-6
lines changed

src/test/ui/async-await/issue-64130-4-async-move.stderr renamed to src/test/ui/async-await/issue-64130-4-async-move.drop-tracking.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
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
33
|
44
LL | 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)`
88
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
1010
|
1111
LL | match client.status() {
1212
| ------ has type `&Client` which is not `Send`
@@ -17,7 +17,7 @@ LL | let _x = get().await;
1717
LL | }
1818
| - `client` is later dropped here
1919
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
2121
|
2222
LL | match client.status() {
2323
| ^^^^^^^^^^^^^^^
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+

src/test/ui/async-await/issue-64130-4-async-move.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
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
26
use std::any::Any;
37
use std::future::Future;
48

@@ -10,16 +14,16 @@ impl Client {
1014
}
1115
}
1216

13-
async fn get() { }
17+
async fn get() {}
1418

1519
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
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
}

0 commit comments

Comments
 (0)