fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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