File tree 2 files changed +30
-5
lines changed
src/test/ui/mismatched_types
2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
fn foo ( _: u16 ) { }
12
+ fn foo1 ( _: f64 ) { }
13
+ fn foo2 ( _: i32 ) { }
14
+
12
15
fn main ( ) {
13
- foo ( 8u8 ) ;
16
+ foo ( 1u8 ) ;
17
+ foo1 ( 2f32 ) ;
18
+ foo2 ( 3i16 ) ;
14
19
}
15
20
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/numeric-literal-cast.rs:13 :9
2
+ --> $DIR/numeric-literal-cast.rs:16 :9
3
3
|
4
- LL | foo(8u8 );
4
+ LL | foo(1u8 );
5
5
| ^^^ expected u16, found u8
6
6
help: change the type of the numeric literal from `u8` to `u16`
7
7
|
8
- LL | foo(8u16 );
8
+ LL | foo(1u16 );
9
9
| ^^^^
10
10
11
- error: aborting due to previous error
11
+ error[E0308]: mismatched types
12
+ --> $DIR/numeric-literal-cast.rs:17:10
13
+ |
14
+ LL | foo1(2f32);
15
+ | ^^^^ expected f64, found f32
16
+ help: change the type of the numeric literal from `f32` to `f64`
17
+ |
18
+ LL | foo1(2f64);
19
+ | ^^^^
20
+
21
+ error[E0308]: mismatched types
22
+ --> $DIR/numeric-literal-cast.rs:18:10
23
+ |
24
+ LL | foo2(3i16);
25
+ | ^^^^ expected i32, found i16
26
+ help: change the type of the numeric literal from `i16` to `i32`
27
+ |
28
+ LL | foo2(3i32);
29
+ | ^^^^
30
+
31
+ error: aborting due to 3 previous errors
12
32
13
33
For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments