fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.5 KiB57 linesraw
1error[E0308]: mismatched types
2  --> $DIR/const-scope.rs:1:16
3   |
4LL | const C: i32 = 1i8;
5   |                ^^^ expected `i32`, found `i8`
6
7error[E0308]: mismatched types
8  --> $DIR/const-scope.rs:2:15
9   |
10LL | const D: i8 = C;
11   |               ^ expected `i8`, found `i32`
12
13error[E0308]: mismatched types
14  --> $DIR/const-scope.rs:5:18
15   |
16LL |     let c: i32 = 1i8;
17   |            ---   ^^^ expected `i32`, found `i8`
18   |            |
19   |            expected due to this
20
21error[E0308]: mismatched types
22  --> $DIR/const-scope.rs:6:17
23   |
24LL |     let d: i8 = c;
25   |            --   ^ expected `i8`, found `i32`
26   |            |
27   |            expected due to this
28
29error[E0308]: mismatched types
30  --> $DIR/const-scope.rs:10:18
31   |
32LL |     let c: i32 = 1i8;
33   |            ---   ^^^ expected `i32`, found `i8`
34   |            |
35   |            expected due to this
36   |
37help: change the type of the numeric literal from `i8` to `i32`
38   |
39LL |     let c: i32 = 1i32;
40   |                  ^^^^
41
42error[E0308]: mismatched types
43  --> $DIR/const-scope.rs:11:17
44   |
45LL |     let d: i8 = c;
46   |            --   ^ expected `i8`, found `i32`
47   |            |
48   |            expected due to this
49   |
50help: you can convert an `i32` to `i8` and panic if the converted value wouldn't fit
51   |
52LL |     let d: i8 = c.try_into().unwrap();
53   |                 ^^^^^^^^^^^^^^^^^^^^^
54
55error: aborting due to 6 previous errors
56
57For more information about this error, try `rustc --explain E0308`.