Skip to content

Commit 15a5bc9

Browse files
authored
Rollup merge of #101779 - eholk:drop-tracking-test-output, r=jyn514
Update test output for drop tracking #97334 has a lot of updates to test outputs that makes the PR larger than it needs to be. This PR pulls those changes out so we can keep the other one as simple as possible. r? `@jyn514`
2 parents 3cb8806 + 87bb475 commit 15a5bc9

20 files changed

+372
-72
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
error: future cannot be sent between threads safely
2+
--> $DIR/async-await-let-else.rs:48:13
3+
|
4+
LL | is_send(foo(Some(true)));
5+
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
6+
|
7+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
8+
note: future is not `Send` as this value is used across an await
9+
--> $DIR/async-await-let-else.rs:11:14
10+
|
11+
LL | let r = Rc::new(());
12+
| - has type `Rc<()>` which is not `Send`
13+
LL | bar().await
14+
| ^^^^^^ await occurs here, with `r` maybe used later
15+
LL | };
16+
| - `r` is later dropped here
17+
note: required by a bound in `is_send`
18+
--> $DIR/async-await-let-else.rs:19:15
19+
|
20+
LL | fn is_send<T: Send>(_: T) {}
21+
| ^^^^ required by this bound in `is_send`
22+
23+
error[E0277]: `Rc<()>` cannot be sent between threads safely
24+
--> $DIR/async-await-let-else.rs:50:13
25+
|
26+
LL | async fn foo2(x: Option<bool>) {
27+
| - within this `impl Future<Output = ()>`
28+
...
29+
LL | is_send(foo2(Some(true)));
30+
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
31+
| |
32+
| required by a bound introduced by this call
33+
|
34+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
35+
note: required because it's used within this `async fn` body
36+
--> $DIR/async-await-let-else.rs:27:29
37+
|
38+
LL | async fn bar2<T>(_: T) -> ! {
39+
| _____________________________^
40+
LL | | panic!()
41+
LL | | }
42+
| |_^
43+
= note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()`
44+
note: required because it's used within this `async fn` body
45+
--> $DIR/async-await-let-else.rs:21:32
46+
|
47+
LL | async fn foo2(x: Option<bool>) {
48+
| ________________________________^
49+
LL | | let Some(_) = x else {
50+
LL | | bar2(Rc::new(())).await
51+
LL | | };
52+
LL | | }
53+
| |_^
54+
note: required by a bound in `is_send`
55+
--> $DIR/async-await-let-else.rs:19:15
56+
|
57+
LL | fn is_send<T: Send>(_: T) {}
58+
| ^^^^ required by this bound in `is_send`
59+
60+
error: future cannot be sent between threads safely
61+
--> $DIR/async-await-let-else.rs:52:13
62+
|
63+
LL | is_send(foo3(Some(true)));
64+
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
65+
|
66+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
67+
note: future is not `Send` as this value is used across an await
68+
--> $DIR/async-await-let-else.rs:33:28
69+
|
70+
LL | (Rc::new(()), bar().await);
71+
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
72+
| |
73+
| has type `Rc<()>` which is not `Send`
74+
note: `Rc::new(())` is later dropped here
75+
--> $DIR/async-await-let-else.rs:33:35
76+
|
77+
LL | (Rc::new(()), bar().await);
78+
| ^
79+
note: required by a bound in `is_send`
80+
--> $DIR/async-await-let-else.rs:19:15
81+
|
82+
LL | fn is_send<T: Send>(_: T) {}
83+
| ^^^^ required by this bound in `is_send`
84+
85+
error: future cannot be sent between threads safely
86+
--> $DIR/async-await-let-else.rs:54:13
87+
|
88+
LL | is_send(foo4(Some(true)));
89+
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
90+
|
91+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
92+
note: future is not `Send` as this value is used across an await
93+
--> $DIR/async-await-let-else.rs:41:14
94+
|
95+
LL | let r = Rc::new(());
96+
| - has type `Rc<()>` which is not `Send`
97+
LL | bar().await;
98+
| ^^^^^^ await occurs here, with `r` maybe used later
99+
...
100+
LL | };
101+
| - `r` is later dropped here
102+
note: required by a bound in `is_send`
103+
--> $DIR/async-await-let-else.rs:19:15
104+
|
105+
LL | fn is_send<T: Send>(_: T) {}
106+
| ^^^^ required by this bound in `is_send`
107+
108+
error: aborting due to 4 previous errors
109+
110+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/async-await/async-await-let-else.stderr src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: future cannot be sent between threads safely
2-
--> $DIR/async-await-let-else.rs:45:13
2+
--> $DIR/async-await-let-else.rs:48:13
33
|
44
LL | is_send(foo(Some(true)));
55
| ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send`
66
|
77
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
88
note: future is not `Send` as this value is used across an await
9-
--> $DIR/async-await-let-else.rs:8:14
9+
--> $DIR/async-await-let-else.rs:11:14
1010
|
1111
LL | let r = Rc::new(());
1212
| - has type `Rc<()>` which is not `Send`
@@ -15,20 +15,20 @@ LL | bar().await
1515
LL | };
1616
| - `r` is later dropped here
1717
note: required by a bound in `is_send`
18-
--> $DIR/async-await-let-else.rs:16:15
18+
--> $DIR/async-await-let-else.rs:19:15
1919
|
2020
LL | fn is_send<T: Send>(_: T) {}
2121
| ^^^^ required by this bound in `is_send`
2222

2323
error: future cannot be sent between threads safely
24-
--> $DIR/async-await-let-else.rs:47:13
24+
--> $DIR/async-await-let-else.rs:50:13
2525
|
2626
LL | is_send(foo2(Some(true)));
2727
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
2828
|
2929
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
3030
note: future is not `Send` as this value is used across an await
31-
--> $DIR/async-await-let-else.rs:20:26
31+
--> $DIR/async-await-let-else.rs:23:26
3232
|
3333
LL | bar2(Rc::new(())).await
3434
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
@@ -37,45 +37,45 @@ LL | bar2(Rc::new(())).await
3737
LL | };
3838
| - `Rc::new(())` is later dropped here
3939
note: required by a bound in `is_send`
40-
--> $DIR/async-await-let-else.rs:16:15
40+
--> $DIR/async-await-let-else.rs:19:15
4141
|
4242
LL | fn is_send<T: Send>(_: T) {}
4343
| ^^^^ required by this bound in `is_send`
4444

4545
error: future cannot be sent between threads safely
46-
--> $DIR/async-await-let-else.rs:49:13
46+
--> $DIR/async-await-let-else.rs:52:13
4747
|
4848
LL | is_send(foo3(Some(true)));
4949
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
5050
|
5151
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
5252
note: future is not `Send` as this value is used across an await
53-
--> $DIR/async-await-let-else.rs:30:28
53+
--> $DIR/async-await-let-else.rs:33:28
5454
|
5555
LL | (Rc::new(()), bar().await);
5656
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
5757
| |
5858
| has type `Rc<()>` which is not `Send`
5959
note: `Rc::new(())` is later dropped here
60-
--> $DIR/async-await-let-else.rs:30:35
60+
--> $DIR/async-await-let-else.rs:33:35
6161
|
6262
LL | (Rc::new(()), bar().await);
6363
| ^
6464
note: required by a bound in `is_send`
65-
--> $DIR/async-await-let-else.rs:16:15
65+
--> $DIR/async-await-let-else.rs:19:15
6666
|
6767
LL | fn is_send<T: Send>(_: T) {}
6868
| ^^^^ required by this bound in `is_send`
6969

7070
error: future cannot be sent between threads safely
71-
--> $DIR/async-await-let-else.rs:51:13
71+
--> $DIR/async-await-let-else.rs:54:13
7272
|
7373
LL | is_send(foo4(Some(true)));
7474
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
7575
|
7676
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
7777
note: future is not `Send` as this value is used across an await
78-
--> $DIR/async-await-let-else.rs:38:14
78+
--> $DIR/async-await-let-else.rs:41:14
7979
|
8080
LL | let r = Rc::new(());
8181
| - has type `Rc<()>` which is not `Send`
@@ -85,7 +85,7 @@ LL | bar().await;
8585
LL | };
8686
| - `r` is later dropped here
8787
note: required by a bound in `is_send`
88-
--> $DIR/async-await-let-else.rs:16:15
88+
--> $DIR/async-await-let-else.rs:19:15
8989
|
9090
LL | fn is_send<T: Send>(_: T) {}
9191
| ^^^^ required by this bound in `is_send`

src/test/ui/async-await/async-await-let-else.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// edition:2021
2+
// revisions: drop-tracking no-drop-tracking
3+
// [drop-tracking] compile-flags: -Zdrop-tracking=yes
4+
// [no-drop-tracking] compile-flags: -Zdrop-tracking=no
25
#![feature(let_else)]
36
use std::rc::Rc;
47

@@ -43,11 +46,11 @@ async fn foo4(x: Option<bool>) {
4346

4447
fn main() {
4548
is_send(foo(Some(true)));
46-
//~^ ERROR future cannot be sent between threads safely
49+
//~^ ERROR cannot be sent between threads safely
4750
is_send(foo2(Some(true)));
48-
//~^ ERROR future cannot be sent between threads safely
51+
//~^ ERROR cannot be sent between threads safely
4952
is_send(foo3(Some(true)));
50-
//~^ ERROR future cannot be sent between threads safely
53+
//~^ ERROR cannot be sent between threads safely
5154
is_send(foo4(Some(true)));
52-
//~^ ERROR future cannot be sent between threads safely
55+
//~^ ERROR cannot be sent between threads safely
5356
}

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

+3-3
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
| ^^^^^^^^^^^^^^^
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

+7-3
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
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
error: future cannot be sent between threads safely
2+
--> $DIR/issue-68112.rs:37:18
3+
|
4+
LL | require_send(send_fut);
5+
| ^^^^^^^^ future created by async block is not `Send`
6+
|
7+
= help: the trait `Sync` is not implemented for `RefCell<i32>`
8+
note: future is not `Send` as it awaits another future which is not `Send`
9+
--> $DIR/issue-68112.rs:34:17
10+
|
11+
LL | let _ = non_send_fut.await;
12+
| ^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
13+
note: required by a bound in `require_send`
14+
--> $DIR/issue-68112.rs:14:25
15+
|
16+
LL | fn require_send(_: impl Send) {}
17+
| ^^^^ required by this bound in `require_send`
18+
19+
error: future cannot be sent between threads safely
20+
--> $DIR/issue-68112.rs:46:18
21+
|
22+
LL | require_send(send_fut);
23+
| ^^^^^^^^ future created by async block is not `Send`
24+
|
25+
= help: the trait `Sync` is not implemented for `RefCell<i32>`
26+
note: future is not `Send` as it awaits another future which is not `Send`
27+
--> $DIR/issue-68112.rs:43:17
28+
|
29+
LL | let _ = make_non_send_future1().await;
30+
| ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl Future<Output = Arc<RefCell<i32>>>`, which is not `Send`
31+
note: required by a bound in `require_send`
32+
--> $DIR/issue-68112.rs:14:25
33+
|
34+
LL | fn require_send(_: impl Send) {}
35+
| ^^^^ required by this bound in `require_send`
36+
37+
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
38+
--> $DIR/issue-68112.rs:65:18
39+
|
40+
LL | require_send(send_fut);
41+
| ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
42+
| |
43+
| required by a bound introduced by this call
44+
|
45+
= help: the trait `Sync` is not implemented for `RefCell<i32>`
46+
= note: required for `Arc<RefCell<i32>>` to implement `Send`
47+
note: required because it's used within this `async fn` body
48+
--> $DIR/issue-68112.rs:50:31
49+
|
50+
LL | async fn ready2<T>(t: T) -> T {
51+
| _______________________________^
52+
LL | | t
53+
LL | | }
54+
| |_^
55+
note: required because it appears within the type `impl Future<Output = Arc<RefCell<i32>>>`
56+
--> $DIR/issue-68112.rs:53:31
57+
|
58+
LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> {
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>`
61+
note: required because it's used within this `async` block
62+
--> $DIR/issue-68112.rs:60:26
63+
|
64+
LL | let send_fut = async {
65+
| __________________________^
66+
LL | | let non_send_fut = make_non_send_future2();
67+
LL | | let _ = non_send_fut.await;
68+
LL | | ready(0).await;
69+
LL | | };
70+
| |_____^
71+
note: required by a bound in `require_send`
72+
--> $DIR/issue-68112.rs:14:25
73+
|
74+
LL | fn require_send(_: impl Send) {}
75+
| ^^^^ required by this bound in `require_send`
76+
77+
error: aborting due to 3 previous errors
78+
79+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)