fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

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