Closed
Description
fn main() {
break 'foo;
}
Will output the following diagnostics:
error[E0426]: use of undeclared label `'foo`
--> src/main.rs:2:11
|
2 | break 'foo;
| ^^^^ undeclared label `'foo`
error[E0268]: `break` outside of a loop
--> src/main.rs:2:5
|
2 | break 'foo;
| ^^^^^^^^^^ cannot `break` outside of a loop
With break
now supported in conjunction with non-loop constructs, we should adjust this diagnostic accordingly. The wording here might be tricky, because something like
cannot
break
outside of a loop or a labeled block
would go stale as soon as we add another thing/place you can break out of, and the wording in general reads awkward regardless...