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