For OutsideLoop we should not suggest add 'block label in if block, or we wiil get another err: block label not supported here.
fixes #123261
This commit is contained in:
parent
60faa271d9
commit
8fde7e3b64
6 changed files with 290 additions and 45 deletions
31
tests/ui/loops/loop-if-else-break-issue-123261.fixed
Normal file
31
tests/ui/loops/loop-if-else-break-issue-123261.fixed
Normal file
|
@ -0,0 +1,31 @@
|
|||
//@ run-rustfix
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
fn main() {
|
||||
let n = 1;
|
||||
let m = 2;
|
||||
let x = 'block: {
|
||||
if n == 0 {
|
||||
break 'block 1; //~ ERROR [E0268]
|
||||
} else {
|
||||
break 'block 2;
|
||||
}
|
||||
};
|
||||
|
||||
let y = 'block: {
|
||||
if n == 0 {
|
||||
break 'block 1; //~ ERROR [E0268]
|
||||
}
|
||||
break 'block 0;
|
||||
};
|
||||
|
||||
let z = 'block: {
|
||||
if n == 0 {
|
||||
if m > 1 {
|
||||
break 'block 3; //~ ERROR [E0268]
|
||||
}
|
||||
}
|
||||
break 'block 1;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue