File tree 2 files changed +51
-7
lines changed
2 files changed +51
-7
lines changed Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
- let x : i8 = loop {
3
- 10 //~ ERROR mismatched types
2
+ let a : i8 = loop {
3
+ 1 //~ ERROR mismatched types
4
4
} ;
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
+ }
5
27
}
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
2
--> $DIR/loop-no-implicit-break.rs:3:9
3
3
|
4
- LL | 10
5
- | ^^ expected `()`, found integer
4
+ LL | 1
5
+ | ^ expected `()`, found integer
6
6
|
7
7
help: you might have meant to break the loop with this value
8
8
|
9
- LL | break 10 ;
10
- | ^^^^^ ^
9
+ LL | break 1 ;
10
+ | ^^^^^ ^
11
11
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
13
35
14
36
For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments