Skip to content

Commit 9259da5

Browse files
committed
Test the 3 generator handling versions for generator/async tests.
1 parent a20078f commit 9259da5

File tree

179 files changed

+5816
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+5816
-196
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
72+
| | |
73+
| | await occurs here, with `Rc::new(())` maybe used later
74+
| has type `Rc<()>` which is not `Send`
75+
note: required by a bound in `is_send`
76+
--> $DIR/async-await-let-else.rs:19:15
77+
|
78+
LL | fn is_send<T: Send>(_: T) {}
79+
| ^^^^ required by this bound in `is_send`
80+
81+
error: future cannot be sent between threads safely
82+
--> $DIR/async-await-let-else.rs:54:13
83+
|
84+
LL | is_send(foo4(Some(true)));
85+
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
86+
|
87+
= 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
89+
--> $DIR/async-await-let-else.rs:41:14
90+
|
91+
LL | let r = Rc::new(());
92+
| - has type `Rc<()>` which is not `Send`
93+
LL | bar().await;
94+
| ^^^^^^ await occurs here, with `r` maybe used later
95+
...
96+
LL | };
97+
| - `r` is later dropped here
98+
note: required by a bound in `is_send`
99+
--> $DIR/async-await-let-else.rs:19:15
100+
|
101+
LL | fn is_send<T: Send>(_: T) {}
102+
| ^^^^ required by this bound in `is_send`
103+
104+
error: aborting due to 4 previous errors
105+
106+
For more information about this error, try `rustc --explain E0277`.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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: future cannot be sent between threads safely
24+
--> $DIR/async-await-let-else.rs:50:13
25+
|
26+
LL | is_send(foo2(Some(true)));
27+
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
28+
|
29+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
30+
note: future is not `Send` as this value is used across an await
31+
--> $DIR/async-await-let-else.rs:23:26
32+
|
33+
LL | bar2(Rc::new(())).await
34+
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
35+
| |
36+
| has type `Rc<()>` which is not `Send`
37+
LL | };
38+
| - `Rc::new(())` is later dropped here
39+
note: required by a bound in `is_send`
40+
--> $DIR/async-await-let-else.rs:19:15
41+
|
42+
LL | fn is_send<T: Send>(_: T) {}
43+
| ^^^^ required by this bound in `is_send`
44+
45+
error: future cannot be sent between threads safely
46+
--> $DIR/async-await-let-else.rs:52:13
47+
|
48+
LL | is_send(foo3(Some(true)));
49+
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
50+
|
51+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
52+
note: future is not `Send` as this value is used across an await
53+
--> $DIR/async-await-let-else.rs:33:28
54+
|
55+
LL | (Rc::new(()), bar().await);
56+
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
57+
| | |
58+
| | await occurs here, with `Rc::new(())` maybe used later
59+
| has type `Rc<()>` which is not `Send`
60+
note: required by a bound in `is_send`
61+
--> $DIR/async-await-let-else.rs:19:15
62+
|
63+
LL | fn is_send<T: Send>(_: T) {}
64+
| ^^^^ required by this bound in `is_send`
65+
66+
error: future cannot be sent between threads safely
67+
--> $DIR/async-await-let-else.rs:54:13
68+
|
69+
LL | is_send(foo4(Some(true)));
70+
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
71+
|
72+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
73+
note: future is not `Send` as this value is used across an await
74+
--> $DIR/async-await-let-else.rs:41:14
75+
|
76+
LL | let r = Rc::new(());
77+
| - has type `Rc<()>` which is not `Send`
78+
LL | bar().await;
79+
| ^^^^^^ await occurs here, with `r` maybe used later
80+
...
81+
LL | };
82+
| - `r` is later dropped here
83+
note: required by a bound in `is_send`
84+
--> $DIR/async-await-let-else.rs:19:15
85+
|
86+
LL | fn is_send<T: Send>(_: T) {}
87+
| ^^^^ required by this bound in `is_send`
88+
89+
error: aborting due to 4 previous errors
90+
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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: future cannot be sent between threads safely
24+
--> $DIR/async-await-let-else.rs:50:13
25+
|
26+
LL | is_send(foo2(Some(true)));
27+
| ^^^^^^^^^^^^^^^^ future returned by `foo2` is not `Send`
28+
|
29+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
30+
note: future is not `Send` as this value is used across an await
31+
--> $DIR/async-await-let-else.rs:23:26
32+
|
33+
LL | bar2(Rc::new(())).await
34+
| ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
35+
| |
36+
| has type `Rc<()>` which is not `Send`
37+
LL | };
38+
| - `Rc::new(())` is later dropped here
39+
note: required by a bound in `is_send`
40+
--> $DIR/async-await-let-else.rs:19:15
41+
|
42+
LL | fn is_send<T: Send>(_: T) {}
43+
| ^^^^ required by this bound in `is_send`
44+
45+
error: future cannot be sent between threads safely
46+
--> $DIR/async-await-let-else.rs:52:13
47+
|
48+
LL | is_send(foo3(Some(true)));
49+
| ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send`
50+
|
51+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
52+
note: future is not `Send` as this value is used across an await
53+
--> $DIR/async-await-let-else.rs:33:28
54+
|
55+
LL | (Rc::new(()), bar().await);
56+
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here
57+
| | |
58+
| | await occurs here, with `Rc::new(())` maybe used later
59+
| has type `Rc<()>` which is not `Send`
60+
note: required by a bound in `is_send`
61+
--> $DIR/async-await-let-else.rs:19:15
62+
|
63+
LL | fn is_send<T: Send>(_: T) {}
64+
| ^^^^ required by this bound in `is_send`
65+
66+
error: future cannot be sent between threads safely
67+
--> $DIR/async-await-let-else.rs:54:13
68+
|
69+
LL | is_send(foo4(Some(true)));
70+
| ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send`
71+
|
72+
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
73+
note: future is not `Send` as this value is used across an await
74+
--> $DIR/async-await-let-else.rs:41:14
75+
|
76+
LL | let r = Rc::new(());
77+
| - has type `Rc<()>` which is not `Send`
78+
LL | bar().await;
79+
| ^^^^^^ await occurs here, with `r` maybe used later
80+
...
81+
LL | };
82+
| - `r` is later dropped here
83+
note: required by a bound in `is_send`
84+
--> $DIR/async-await-let-else.rs:19:15
85+
|
86+
LL | fn is_send<T: Send>(_: T) {}
87+
| ^^^^ required by this bound in `is_send`
88+
89+
error: aborting due to 4 previous errors
90+

tests/ui/async-await/async-await-let-else.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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
2+
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
3+
// [drop_tracking] compile-flags: -Zdrop-tracking
4+
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
55

66
use std::rc::Rc;
77

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0277]: `()` is not a future
2+
--> $DIR/async-error-span.rs:10:20
3+
|
4+
LL | fn get_future() -> impl Future<Output = ()> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
6+
|
7+
= help: the trait `Future` is not implemented for `()`
8+
= note: () must be a future or must implement `IntoFuture` to be awaited
9+
10+
error[E0698]: type inside `async fn` body must be known in this context
11+
--> $DIR/async-error-span.rs:16:9
12+
|
13+
LL | let a;
14+
| ^ cannot infer type
15+
|
16+
note: the type is part of the `async fn` body because of this `await`
17+
--> $DIR/async-error-span.rs:17:17
18+
|
19+
LL | get_future().await;
20+
| ^^^^^^
21+
22+
error: aborting due to 2 previous errors
23+
24+
Some errors have detailed explanations: E0277, E0698.
25+
For more information about an error, try `rustc --explain E0277`.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0277]: `()` is not a future
2+
--> $DIR/async-error-span.rs:10:20
3+
|
4+
LL | fn get_future() -> impl Future<Output = ()> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
6+
|
7+
= help: the trait `Future` is not implemented for `()`
8+
= note: () must be a future or must implement `IntoFuture` to be awaited
9+
10+
error[E0698]: type inside `async fn` body must be known in this context
11+
--> $DIR/async-error-span.rs:16:9
12+
|
13+
LL | let a;
14+
| ^ cannot infer type
15+
|
16+
note: the type is part of the `async fn` body because of this `await`
17+
--> $DIR/async-error-span.rs:17:17
18+
|
19+
LL | get_future().await;
20+
| ^^^^^^
21+
22+
error: aborting due to 2 previous errors
23+
24+
Some errors have detailed explanations: E0277, E0698.
25+
For more information about an error, try `rustc --explain E0277`.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0277]: `()` is not a future
2+
--> $DIR/async-error-span.rs:10:20
3+
|
4+
LL | fn get_future() -> impl Future<Output = ()> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future
6+
|
7+
= help: the trait `Future` is not implemented for `()`
8+
= note: () must be a future or must implement `IntoFuture` to be awaited
9+
10+
error[E0698]: type inside `async fn` body must be known in this context
11+
--> $DIR/async-error-span.rs:16:9
12+
|
13+
LL | let a;
14+
| ^ cannot infer type
15+
|
16+
note: the type is part of the `async fn` body because of this `await`
17+
--> $DIR/async-error-span.rs:17:17
18+
|
19+
LL | get_future().await;
20+
| ^^^^^^
21+
22+
error: aborting due to 2 previous errors
23+
24+
Some errors have detailed explanations: E0277, E0698.
25+
For more information about an error, try `rustc --explain E0277`.

tests/ui/async-await/async-error-span.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
2+
// [drop_tracking] compile-flags: -Zdrop-tracking
3+
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
14
// edition:2018
25

36
// Regression test for issue #62382.

0 commit comments

Comments
 (0)