-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.
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...
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.