File tree Expand file tree Collapse file tree 2 files changed +51
-7
lines changed Expand file tree Collapse file tree 2 files changed +51
-7
lines changed Original file line number Diff line number Diff line change 11fn main ( ) {
2- let x : i8 = loop {
3- 10 //~ ERROR mismatched types
2+ let a : i8 = loop {
3+ 1 //~ ERROR mismatched types
44 } ;
5+
6+ let b: i8 = loop {
7+ break 1 ;
8+ } ;
9+ }
10+
11+ fn foo ( ) -> i8 {
12+ let a: i8 = loop {
13+ 1 //~ ERROR mismatched types
14+ } ;
15+
16+ let b: i8 = loop {
17+ break 1 ;
18+ } ;
19+
20+ loop {
21+ 1 //~ ERROR mismatched types
22+ }
23+
24+ loop {
25+ return 1 ;
26+ }
527}
Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
22 --> $DIR/loop-no-implicit-break.rs:3:9
33 |
4- LL | 10
5- | ^^ expected `()`, found integer
4+ LL | 1
5+ | ^ expected `()`, found integer
66 |
77help: you might have meant to break the loop with this value
88 |
9- LL | break 10 ;
10- | ^^^^^ ^
9+ LL | break 1 ;
10+ | ^^^^^ ^
1111
12- error: aborting due to previous error
12+ error[E0308]: mismatched types
13+ --> $DIR/loop-no-implicit-break.rs:13:9
14+ |
15+ LL | 1
16+ | ^ expected `()`, found integer
17+ |
18+ help: you might have meant to break the loop with this value
19+ |
20+ LL | break 1;
21+ | ^^^^^ ^
22+
23+ error[E0308]: mismatched types
24+ --> $DIR/loop-no-implicit-break.rs:21:9
25+ |
26+ LL | 1
27+ | ^ expected `()`, found integer
28+ |
29+ help: you might have meant to return this value
30+ |
31+ LL | return 1;
32+ | ^^^^^^ ^
33+
34+ error: aborting due to 3 previous errors
1335
1436For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments