Skip to content

Commit 073ac59

Browse files
Add Tests
1 parent 64ebd39 commit 073ac59

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fn main() {
2+
let _ = ['a'; { break 2; 1 }];
3+
//~^ ERROR `break` outside of a loop or labeled block
4+
//~| HELP consider labeling this block to be able to break within it
5+
6+
const {
7+
{
8+
//~^ HELP consider labeling this block to be able to break within it
9+
break;
10+
//~^ ERROR `break` outside of a loop or labeled block
11+
}
12+
};
13+
14+
const {
15+
break;
16+
//~^ ERROR `break` outside of a loop or labeled block
17+
};
18+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0268]: `break` outside of a loop or labeled block
2+
--> $DIR/break-inside-inline-const-issue-128604.rs:15:9
3+
|
4+
LL | break;
5+
| ^^^^^ cannot `break` outside of a loop or labeled block
6+
7+
error[E0268]: `break` outside of a loop or labeled block
8+
--> $DIR/break-inside-inline-const-issue-128604.rs:2:21
9+
|
10+
LL | let _ = ['a'; { break 2; 1 }];
11+
| ^^^^^^^ cannot `break` outside of a loop or labeled block
12+
|
13+
help: consider labeling this block to be able to break within it
14+
|
15+
LL | let _ = ['a'; 'block: { break 'block 2; 1 }];
16+
| +++++++ ++++++
17+
18+
error[E0268]: `break` outside of a loop or labeled block
19+
--> $DIR/break-inside-inline-const-issue-128604.rs:9:13
20+
|
21+
LL | break;
22+
| ^^^^^ cannot `break` outside of a loop or labeled block
23+
|
24+
help: consider labeling this block to be able to break within it
25+
|
26+
LL ~ 'block: {
27+
LL |
28+
LL ~ break 'block;
29+
|
30+
31+
error: aborting due to 3 previous errors
32+
33+
For more information about this error, try `rustc --explain E0268`.

0 commit comments

Comments
 (0)