File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed
src/test/ui/mismatched_types Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 99// except according to those terms.
1010
1111fn foo ( _: u16 ) { }
12+ fn foo1 ( _: f64 ) { }
13+ fn foo2 ( _: i32 ) { }
14+
1215fn main ( ) {
13- foo ( 8u8 ) ;
16+ foo ( 1u8 ) ;
17+ foo1 ( 2f32 ) ;
18+ foo2 ( 3i16 ) ;
1419}
1520
Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
2- --> $DIR/numeric-literal-cast.rs:13 :9
2+ --> $DIR/numeric-literal-cast.rs:16 :9
33 |
4- LL | foo(8u8 );
4+ LL | foo(1u8 );
55 | ^^^ expected u16, found u8
66help: change the type of the numeric literal from `u8` to `u16`
77 |
8- LL | foo(8u16 );
8+ LL | foo(1u16 );
99 | ^^^^
1010
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
1232
1333For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments