You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/lint/type-overflow.stderr
+26-2
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,33 @@ warning: literal out of range for `i8`
16
16
--> $DIR/type-overflow.rs:10:16
17
17
|
18
18
LL | let fail = 0b1000_0001i8;
19
-
| ^^^^^^^^^^^^^ help: consider using the type `u8` instead: `0b1000_0001u8`
19
+
| ^^^^^^^^^^^^^
20
20
|
21
21
= note: the literal `0b1000_0001i8` (decimal `129`) does not fit into the type `i8` and will become `-127i8`
22
+
help: consider using the type `u8` instead
23
+
|
24
+
LL | let fail = 0b1000_0001u8;
25
+
| ~~~~~~~~~~~~~
26
+
help: to use as a negative number (decimal `-127`), consider using the type `u8` for the literal and cast it to `i8`
27
+
|
28
+
LL | let fail = 0b1000_0001u8 as i8;
29
+
| ~~~~~~~~~~~~~~~~~~~
22
30
23
31
warning: literal out of range for `i64`
24
32
--> $DIR/type-overflow.rs:12:16
25
33
|
26
34
LL | let fail = 0x8000_0000_0000_0000i64;
27
-
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using the type `u64` instead: `0x8000_0000_0000_0000u64`
35
+
| ^^^^^^^^^^^^^^^^^^^^^^^^
28
36
|
29
37
= note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into the type `i64` and will become `-9223372036854775808i64`
38
+
help: consider using the type `u64` instead
39
+
|
40
+
LL | let fail = 0x8000_0000_0000_0000u64;
41
+
| ~~~~~~~~~~~~~~~~~~~~~~~~
42
+
help: to use as a negative number (decimal `-9223372036854775808`), consider using the type `u64` for the literal and cast it to `i64`
= note: the literal `0x8000_0000_0000_0000_0000_0000_0000_0000` (decimal `170141183460469231731687303715884105728`) does not fit into the type `i128` and will become `-170141183460469231731687303715884105728i128`
46
62
= help: consider using the type `u128` instead
63
+
help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128`
64
+
|
65
+
LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128;
0 commit comments