Skip to content

Commit 4271383

Browse files
Update Tests
1 parent 9c9b568 commit 4271383

4 files changed

+101
-6
lines changed

tests/ui/async-await/async-block-control-flow-static-semantics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ async fn return_targets_async_block_not_async_fn() -> u8 {
2929

3030
fn no_break_in_async_block() {
3131
async {
32-
break 0u8; //~ ERROR `break` inside of an `async` block
32+
break 0u8; //~ ERROR `break` inside `async` block
3333
};
3434
}
3535

3636
fn no_break_in_async_block_even_with_outer_loop() {
3737
loop {
3838
async {
39-
break 0u8; //~ ERROR `break` inside of an `async` block
39+
break 0u8; //~ ERROR `break` inside `async` block
4040
};
4141
}
4242
}

tests/ui/async-await/async-block-control-flow-static-semantics.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
error[E0267]: `break` inside of an `async` block
1+
error[E0267]: `break` inside `async` block
22
--> $DIR/async-block-control-flow-static-semantics.rs:32:9
33
|
44
LL | / async {
55
LL | | break 0u8;
6-
| | ^^^^^^^^^ cannot `break` inside of an `async` block
6+
| | ^^^^^^^^^ cannot `break` inside `async` block
77
LL | | };
88
| |_____- enclosing `async` block
99

10-
error[E0267]: `break` inside of an `async` block
10+
error[E0267]: `break` inside `async` block
1111
--> $DIR/async-block-control-flow-static-semantics.rs:39:13
1212
|
1313
LL | / async {
1414
LL | | break 0u8;
15-
| | ^^^^^^^^^ cannot `break` inside of an `async` block
15+
| | ^^^^^^^^^ cannot `break` inside `async` block
1616
LL | | };
1717
| |_________- enclosing `async` block
1818

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ edition: 2024
2+
//@ compile-flags: -Z unstable-options
3+
4+
#![feature(gen_blocks)]
5+
#![feature(async_closure)]
6+
7+
async fn async_fn() {
8+
break; //~ ERROR `break` inside `async` function
9+
}
10+
11+
gen fn gen_fn() {
12+
break; //~ ERROR `break` inside `gen` function
13+
}
14+
15+
async gen fn async_gen_fn() {
16+
break; //~ ERROR `break` inside `async gen` function
17+
}
18+
19+
fn main() {
20+
let _ = async { break; }; //~ ERROR `break` inside `async` block
21+
let _ = async || { break; }; //~ ERROR `break` inside `async` closure
22+
23+
let _ = gen { break; }; //~ ERROR `break` inside `gen` block
24+
25+
let _ = async gen { break; }; //~ ERROR `break` inside `async gen` block
26+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
error[E0267]: `break` inside `async` function
2+
--> $DIR/break-inside-coroutine-issue-124495.rs:8:5
3+
|
4+
LL | async fn async_fn() {
5+
| _____________________-
6+
LL | | break;
7+
| | ^^^^^ cannot `break` inside `async` function
8+
LL | | }
9+
| |_- enclosing `async` function
10+
11+
error[E0267]: `break` inside `gen` function
12+
--> $DIR/break-inside-coroutine-issue-124495.rs:12:5
13+
|
14+
LL | gen fn gen_fn() {
15+
| _________________-
16+
LL | | break;
17+
| | ^^^^^ cannot `break` inside `gen` function
18+
LL | | }
19+
| |_- enclosing `gen` function
20+
21+
error[E0267]: `break` inside `async gen` function
22+
--> $DIR/break-inside-coroutine-issue-124495.rs:16:5
23+
|
24+
LL | async gen fn async_gen_fn() {
25+
| _____________________________-
26+
LL | | break;
27+
| | ^^^^^ cannot `break` inside `async gen` function
28+
LL | | }
29+
| |_- enclosing `async gen` function
30+
31+
error[E0267]: `break` inside `async` block
32+
--> $DIR/break-inside-coroutine-issue-124495.rs:20:21
33+
|
34+
LL | let _ = async { break; };
35+
| --------^^^^^---
36+
| | |
37+
| | cannot `break` inside `async` block
38+
| enclosing `async` block
39+
40+
error[E0267]: `break` inside `async` closure
41+
--> $DIR/break-inside-coroutine-issue-124495.rs:21:24
42+
|
43+
LL | let _ = async || { break; };
44+
| --^^^^^---
45+
| | |
46+
| | cannot `break` inside `async` closure
47+
| enclosing `async` closure
48+
49+
error[E0267]: `break` inside `gen` block
50+
--> $DIR/break-inside-coroutine-issue-124495.rs:23:19
51+
|
52+
LL | let _ = gen { break; };
53+
| ------^^^^^---
54+
| | |
55+
| | cannot `break` inside `gen` block
56+
| enclosing `gen` block
57+
58+
error[E0267]: `break` inside `async gen` block
59+
--> $DIR/break-inside-coroutine-issue-124495.rs:25:25
60+
|
61+
LL | let _ = async gen { break; };
62+
| ------------^^^^^---
63+
| | |
64+
| | cannot `break` inside `async gen` block
65+
| enclosing `async gen` block
66+
67+
error: aborting due to 7 previous errors
68+
69+
For more information about this error, try `rustc --explain E0267`.

0 commit comments

Comments
 (0)