mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
More tests.
This commit is contained in:
parent
8bc81a0e4d
commit
05a5a1128f
@ -1,5 +1,27 @@
|
||||
fn main() {
|
||||
let x: i8 = loop {
|
||||
10 //~ ERROR mismatched types
|
||||
let a: i8 = loop {
|
||||
1 //~ ERROR mismatched types
|
||||
};
|
||||
|
||||
let b: i8 = loop {
|
||||
break 1;
|
||||
};
|
||||
}
|
||||
|
||||
fn foo() -> i8 {
|
||||
let a: i8 = loop {
|
||||
1 //~ ERROR mismatched types
|
||||
};
|
||||
|
||||
let b: i8 = loop {
|
||||
break 1;
|
||||
};
|
||||
|
||||
loop {
|
||||
1 //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
loop {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,36 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-no-implicit-break.rs:3:9
|
||||
|
|
||||
LL | 10
|
||||
| ^^ expected `()`, found integer
|
||||
LL | 1
|
||||
| ^ expected `()`, found integer
|
||||
|
|
||||
help: you might have meant to break the loop with this value
|
||||
|
|
||||
LL | break 10;
|
||||
| ^^^^^ ^
|
||||
LL | break 1;
|
||||
| ^^^^^ ^
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-no-implicit-break.rs:13:9
|
||||
|
|
||||
LL | 1
|
||||
| ^ expected `()`, found integer
|
||||
|
|
||||
help: you might have meant to break the loop with this value
|
||||
|
|
||||
LL | break 1;
|
||||
| ^^^^^ ^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/loop-no-implicit-break.rs:21:9
|
||||
|
|
||||
LL | 1
|
||||
| ^ expected `()`, found integer
|
||||
|
|
||||
help: you might have meant to return this value
|
||||
|
|
||||
LL | return 1;
|
||||
| ^^^^^^ ^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
Loading…
Reference in New Issue
Block a user