|
3 | 3 |
|
4 | 4 | fn main() {
|
5 | 5 | let error = 255i8; //~WARNING literal out of range for `i8`
|
| 6 | + //~^ HELP consider using the type `u8` instead |
6 | 7 |
|
7 | 8 | let ok = 0b1000_0001; // should be ok -> i32
|
8 | 9 | let ok = 0b0111_1111i8; // should be ok -> 127i8
|
9 | 10 |
|
10 | 11 | let fail = 0b1000_0001i8; //~WARNING literal out of range for `i8`
|
| 12 | + //~^ HELP consider using the type `u8` instead |
| 13 | + //~| HELP consider using the type `u8` for the literal and cast it to `i8` |
11 | 14 |
|
12 | 15 | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range for `i64`
|
| 16 | + //~^ HELP consider using the type `u64` instead |
| 17 | + //~| HELP consider using the type `u64` for the literal and cast it to `i64` |
13 | 18 |
|
14 | 19 | let fail = 0x1_FFFF_FFFFu32; //~WARNING literal out of range for `u32`
|
| 20 | + //~^ HELP consider using the type `u64` instead |
15 | 21 |
|
16 | 22 | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000;
|
17 | 23 | //~^ WARNING literal out of range for `i128`
|
| 24 | + //~| HELP consider using the type `u128` instead |
| 25 | + //~| HELP consider using the type `u128` for the literal and cast it to `i128` |
| 26 | + |
| 27 | + let fail = 0x8000_0000_0000_0000_0000_0000_0000_0000; |
| 28 | + //~^ WARNING literal out of range for `i32` |
| 29 | + //~| HELP consider using the type `u128` instead |
| 30 | + |
| 31 | + let fail = -0x8000_0000_0000_0000_0000_0000_0000_0000; // issue #131849 |
| 32 | + //~^ WARNING literal out of range for `i32` |
| 33 | + //~| HELP consider using the type `i128` instead |
| 34 | + |
| 35 | + let fail = -0x8000_0000_0000_0000_0000_0000_0000_0001i128; |
| 36 | + //~^ WARNING literal out of range for `i128` |
| 37 | + |
| 38 | + let fail = 340282366920938463463374607431768211455i8; |
| 39 | + //~^ WARNING literal out of range for `i8` |
| 40 | + //~| HELP consider using the type `u128` instead |
18 | 41 |
|
19 | 42 | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for `i32`
|
| 43 | + //~| HELP consider using the type `u64` instead |
| 44 | + //~| HELP |
20 | 45 |
|
21 | 46 | let fail = -0b1111_1111i8; //~WARNING literal out of range for `i8`
|
| 47 | + //~| HELP consider using the type `i16` instead |
22 | 48 | }
|
0 commit comments