-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case for break expr with misspelled value
Update src/test/ui/loops/loop-break-value.rs Co-authored-by: Ivan Tham <pickfire@riseup.net>
- Loading branch information
Showing
4 changed files
with
93 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
fn main() { | ||
'LOOP: loop { | ||
LOOP; | ||
//~^ ERROR cannot find value `LOOP` in this scope | ||
}; | ||
'while_loop: while true { //~ WARN denote infinite loops with | ||
while_loop; | ||
//~^ ERROR cannot find value `while_loop` in this scope | ||
}; | ||
'while_let: while let Some(_) = Some(()) { | ||
while_let; | ||
//~^ ERROR cannot find value `while_let` in this scope | ||
} | ||
'for_loop: for _ in 0..3 { | ||
for_loop; | ||
//~^ ERROR cannot find value `for_loop` in this scope | ||
}; | ||
} |
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,47 @@ | ||
error[E0425]: cannot find value `LOOP` in this scope | ||
--> $DIR/label_misspelled.rs:3:9 | ||
| | ||
LL | LOOP; | ||
| ^^^^ | ||
| | | ||
| not found in this scope | ||
| help: a label with a similar name exists: `'LOOP` | ||
|
||
error[E0425]: cannot find value `while_loop` in this scope | ||
--> $DIR/label_misspelled.rs:7:9 | ||
| | ||
LL | while_loop; | ||
| ^^^^^^^^^^ | ||
| | | ||
| not found in this scope | ||
| help: a label with a similar name exists: `'while_loop` | ||
|
||
error[E0425]: cannot find value `while_let` in this scope | ||
--> $DIR/label_misspelled.rs:11:9 | ||
| | ||
LL | while_let; | ||
| ^^^^^^^^^ | ||
| | | ||
| not found in this scope | ||
| help: a label with a similar name exists: `'while_let` | ||
|
||
error[E0425]: cannot find value `for_loop` in this scope | ||
--> $DIR/label_misspelled.rs:15:9 | ||
| | ||
LL | for_loop; | ||
| ^^^^^^^^ | ||
| | | ||
| not found in this scope | ||
| help: a label with a similar name exists: `'for_loop` | ||
|
||
warning: denote infinite loops with `loop { ... }` | ||
--> $DIR/label_misspelled.rs:6:5 | ||
| | ||
LL | 'while_loop: while true { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop` | ||
| | ||
= note: `#[warn(while_true)]` on by default | ||
|
||
error: aborting due to 4 previous errors; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0425`. |
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