Add Tests
This commit is contained in:
parent
64ebd39da5
commit
764675e01a
@ -0,0 +1,18 @@
|
||||
fn main() {
|
||||
let _ = ['a'; { break 2; 1 }];
|
||||
//~^ ERROR `break` outside of a loop or labeled block
|
||||
//~| HELP consider labeling this block to be able to break within it
|
||||
|
||||
const {
|
||||
{
|
||||
//~^ HELP consider labeling this block to be able to break within it
|
||||
break;
|
||||
//~^ ERROR `break` outside of a loop or labeled block
|
||||
}
|
||||
};
|
||||
|
||||
const {
|
||||
break;
|
||||
//~^ ERROR `break` outside of a loop or labeled block
|
||||
};
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-inside-inline-const-issue-128604.rs:2:21
|
||||
|
|
||||
LL | let _ = ['a'; { break 2; 1 }];
|
||||
| ^^^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
|
||||
help: consider labeling this block to be able to break within it
|
||||
|
|
||||
LL | let _ = ['a'; 'block: { break 'block 2; 1 }];
|
||||
| +++++++ ++++++
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-inside-inline-const-issue-128604.rs:9:13
|
||||
|
|
||||
LL | break;
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
|
||||
help: consider labeling this block to be able to break within it
|
||||
|
|
||||
LL ~ 'block: {
|
||||
LL |
|
||||
LL ~ break 'block;
|
||||
|
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-inside-inline-const-issue-128604.rs:15:9
|
||||
|
|
||||
LL | break;
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
|
||||
help: consider labeling this block to be able to break within it
|
||||
|
|
||||
LL ~ const 'block: {
|
||||
LL ~ break 'block;
|
||||
|
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0268`.
|
18
tests/ui/unsafe/break-inside-unsafe-block-issue-128604.rs
Normal file
18
tests/ui/unsafe/break-inside-unsafe-block-issue-128604.rs
Normal file
@ -0,0 +1,18 @@
|
||||
fn main() {
|
||||
let a = ["_"; unsafe { break; 1 + 2 }];
|
||||
//~^ ERROR `break` outside of a loop or labeled block
|
||||
|
||||
unsafe {
|
||||
{
|
||||
//~^ HELP consider labeling this block to be able to break within it
|
||||
break;
|
||||
//~^ ERROR `break` outside of a loop or labeled block
|
||||
}
|
||||
}
|
||||
|
||||
unsafe {
|
||||
break;
|
||||
//~^ ERROR `break` outside of a loop or labeled block
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-inside-unsafe-block-issue-128604.rs:2:28
|
||||
|
|
||||
LL | let a = ["_"; unsafe { break; 1 + 2 }];
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
|
||||
help: consider labeling this block to be able to break within it
|
||||
|
|
||||
LL | let a = ["_"; 'block: unsafe { break 'block; 1 + 2 }];
|
||||
| +++++++ ++++++
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-inside-unsafe-block-issue-128604.rs:8:13
|
||||
|
|
||||
LL | break;
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
|
||||
help: consider labeling this block to be able to break within it
|
||||
|
|
||||
LL ~ 'block: {
|
||||
LL |
|
||||
LL ~ break 'block;
|
||||
|
|
||||
|
||||
error[E0268]: `break` outside of a loop or labeled block
|
||||
--> $DIR/break-inside-unsafe-block-issue-128604.rs:14:9
|
||||
|
|
||||
LL | break;
|
||||
| ^^^^^ cannot `break` outside of a loop or labeled block
|
||||
|
|
||||
help: consider labeling this block to be able to break within it
|
||||
|
|
||||
LL ~ 'block: unsafe {
|
||||
LL ~ break 'block;
|
||||
|
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0268`.
|
Loading…
Reference in New Issue
Block a user