-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check break target availability when checking breaks with values
Fixes #66702
- Loading branch information
Showing
3 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Breaks with values inside closures used to ICE (#66863) | ||
|
||
fn main() { | ||
'some_label: loop { | ||
|| break 'some_label (); //~ ERROR: `break` inside of a closure | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/issues/issue-66702-break-outside-loop-val.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0267]: `break` inside of a closure | ||
--> $DIR/issue-66702-break-outside-loop-val.rs:5:12 | ||
| | ||
LL | || break 'some_label (); | ||
| -- ^^^^^^^^^^^^^^^^^^^^ cannot `break` inside of a closure | ||
| | | ||
| enclosing closure | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0267`. |