2018-01-06 23:10:51 -06:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/numeric-cast-2.rs:15:18
|
|
|
|
|
|
|
|
|
15 | let x: u32 = foo();
|
|
|
|
| ^^^^^ expected u32, found i32
|
|
|
|
help: you can cast an `i32` to `u32`, which will sign-extend the source value
|
|
|
|
|
|
|
|
|
15 | let x: u32 = foo() as u32;
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2018-01-07 14:27:03 -06:00
|
|
|
--> $DIR/numeric-cast-2.rs:17:18
|
2018-01-06 23:10:51 -06:00
|
|
|
|
|
2018-01-07 14:27:03 -06:00
|
|
|
17 | let z: i32 = x + x;
|
2018-01-06 23:10:51 -06:00
|
|
|
| ^^^^^ expected i32, found u32
|
|
|
|
help: you can cast an `u32` to `i32`, which will truncate the source value
|
|
|
|
|
|
2018-01-07 14:27:03 -06:00
|
|
|
17 | let z: i32 = (x + x) as i32;
|
2018-01-06 23:10:51 -06:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|