Skip to content

Commit 03abfde

Browse files
committed
Add regression test for break inside const items
1 parent e6152cd commit 03abfde

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

tests/ui/inline-const/break-inside-inline-const-issue-128604.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ fn main() {
2323
}
2424
}
2525
}
26+
27+
const FOO: () = break;
28+
//~^ ERROR: `break` outside of a loop or labeled block
29+
30+
static BAR: () = break;
31+
//~^ ERROR: `break` outside of a loop or labeled block

tests/ui/inline-const/break-inside-inline-const-issue-128604.stderr

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ error[E0268]: `break` outside of a loop or labeled block
1010
LL | break;
1111
| ^^^^^ cannot `break` outside of a loop or labeled block
1212

13+
error[E0268]: `break` outside of a loop or labeled block
14+
--> $DIR/break-inside-inline-const-issue-128604.rs:27:17
15+
|
16+
LL | const FOO: () = break;
17+
| ^^^^^ cannot `break` outside of a loop or labeled block
18+
19+
error[E0268]: `break` outside of a loop or labeled block
20+
--> $DIR/break-inside-inline-const-issue-128604.rs:30:18
21+
|
22+
LL | static BAR: () = break;
23+
| ^^^^^ cannot `break` outside of a loop or labeled block
24+
1325
error[E0268]: `break` outside of a loop or labeled block
1426
--> $DIR/break-inside-inline-const-issue-128604.rs:2:21
1527
|
@@ -34,6 +46,6 @@ LL |
3446
LL ~ break 'block;
3547
|
3648

37-
error: aborting due to 4 previous errors
49+
error: aborting due to 6 previous errors
3850

3951
For more information about this error, try `rustc --explain E0268`.

0 commit comments

Comments
 (0)