Added a test.
This commit is contained in:
parent
ad78b50a86
commit
0e7489a2e9
2 changed files with 19 additions and 0 deletions
5
src/test/ui/loops/loop-no-implicit-break.rs
Normal file
5
src/test/ui/loops/loop-no-implicit-break.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
let x: i8 = loop {
|
||||
10 //~ ERROR mismatched types
|
||||
};
|
||||
}
|
||||
14
src/test/ui/loops/loop-no-implicit-break.stderr
Normal file
14
src/test/ui/loops/loop-no-implicit-break.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-no-implicit-break.rs:3:9
|
||||
|
|
||||
LL | 10
|
||||
| ^^ expected `()`, found integer
|
||||
|
|
||||
help: you might have meant to break the loop with this value
|
||||
|
|
||||
LL | break 10;
|
||||
| ^^^^^ ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue