fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.1 KiB36 linesraw
1error[E0308]: mismatched types
2  --> $DIR/numeric-cast-2.rs:5:18
3   |
4LL |     let x: u16 = foo();
5   |                  ^^^^^ expected u16, found i32
6   |
7help: you can convert an `i32` to `u16` and panic if the converted value wouldn't fit
8   |
9LL |     let x: u16 = foo().try_into().unwrap();
10   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^
11
12error[E0308]: mismatched types
13  --> $DIR/numeric-cast-2.rs:7:18
14   |
15LL |     let y: i64 = x + x;
16   |                  ^^^^^ expected i64, found u16
17   |
18help: you can convert an `u16` to `i64` and panic if the converted value wouldn't fit
19   |
20LL |     let y: i64 = (x + x).try_into().unwrap();
21   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
23error[E0308]: mismatched types
24  --> $DIR/numeric-cast-2.rs:9:18
25   |
26LL |     let z: i32 = x + x;
27   |                  ^^^^^ expected i32, found u16
28   |
29help: you can convert an `u16` to `i32` and panic if the converted value wouldn't fit
30   |
31LL |     let z: i32 = (x + x).try_into().unwrap();
32   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
33
34error: aborting due to 3 previous errors
35
36For more information about this error, try `rustc --explain E0308`.