@@ -26,6 +26,7 @@ LL | let x1: i8 = 128;
2626 | ^^^
2727 |
2828 = note: the literal `128` does not fit into the type `i8` whose range is `-128..=127`
29+ = help: consider using `u8` instead
2930
3031error: literal out of range for `i8`
3132 --> $DIR/lint-type-overflow.rs:18:19
@@ -34,6 +35,7 @@ LL | let x3: i8 = -129;
3435 | ^^^
3536 |
3637 = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
38+ = help: consider using `i16` instead
3739
3840error: literal out of range for `i8`
3941 --> $DIR/lint-type-overflow.rs:19:19
@@ -42,6 +44,7 @@ LL | let x3: i8 = -(129);
4244 | ^^^^^
4345 |
4446 = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
47+ = help: consider using `i16` instead
4548
4649error: literal out of range for `i8`
4750 --> $DIR/lint-type-overflow.rs:20:20
@@ -50,6 +53,7 @@ LL | let x3: i8 = -{129};
5053 | ^^^
5154 |
5255 = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
56+ = help: consider using `u8` instead
5357
5458error: literal out of range for `i8`
5559 --> $DIR/lint-type-overflow.rs:22:10
@@ -58,6 +62,7 @@ LL | test(1000);
5862 | ^^^^
5963 |
6064 = note: the literal `1000` does not fit into the type `i8` whose range is `-128..=127`
65+ = help: consider using `i16` instead
6166
6267error: literal out of range for `i8`
6368 --> $DIR/lint-type-overflow.rs:24:13
@@ -66,6 +71,7 @@ LL | let x = 128_i8;
6671 | ^^^^^^
6772 |
6873 = note: the literal `128_i8` does not fit into the type `i8` whose range is `-128..=127`
74+ = help: consider using `u8` instead
6975
7076error: literal out of range for `i8`
7177 --> $DIR/lint-type-overflow.rs:28:14
@@ -74,6 +80,7 @@ LL | let x = -129_i8;
7480 | ^^^^^^
7581 |
7682 = note: the literal `129_i8` does not fit into the type `i8` whose range is `-128..=127`
83+ = help: consider using `i16` instead
7784
7885error: literal out of range for `i32`
7986 --> $DIR/lint-type-overflow.rs:32:18
@@ -82,6 +89,7 @@ LL | let x: i32 = 2147483648;
8289 | ^^^^^^^^^^
8390 |
8491 = note: the literal `2147483648` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
92+ = help: consider using `u32` instead
8593
8694error: literal out of range for `i32`
8795 --> $DIR/lint-type-overflow.rs:33:13
@@ -90,6 +98,7 @@ LL | let x = 2147483648_i32;
9098 | ^^^^^^^^^^^^^^
9199 |
92100 = note: the literal `2147483648_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
101+ = help: consider using `u32` instead
93102
94103error: literal out of range for `i32`
95104 --> $DIR/lint-type-overflow.rs:36:19
@@ -98,6 +107,7 @@ LL | let x: i32 = -2147483649;
98107 | ^^^^^^^^^^
99108 |
100109 = note: the literal `2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
110+ = help: consider using `i64` instead
101111
102112error: literal out of range for `i32`
103113 --> $DIR/lint-type-overflow.rs:37:14
@@ -106,6 +116,7 @@ LL | let x = -2147483649_i32;
106116 | ^^^^^^^^^^^^^^
107117 |
108118 = note: the literal `2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
119+ = help: consider using `i64` instead
109120
110121error: literal out of range for `i32`
111122 --> $DIR/lint-type-overflow.rs:38:13
@@ -114,6 +125,7 @@ LL | let x = 2147483648;
114125 | ^^^^^^^^^^
115126 |
116127 = note: the literal `2147483648` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
128+ = help: consider using `u32` instead
117129
118130error: literal out of range for `i64`
119131 --> $DIR/lint-type-overflow.rs:40:13
@@ -122,6 +134,7 @@ LL | let x = 9223372036854775808_i64;
122134 | ^^^^^^^^^^^^^^^^^^^^^^^
123135 |
124136 = note: the literal `9223372036854775808_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
137+ = help: consider using `u64` instead
125138
126139error: literal out of range for `i64`
127140 --> $DIR/lint-type-overflow.rs:42:13
@@ -130,6 +143,7 @@ LL | let x = 18446744073709551615_i64;
130143 | ^^^^^^^^^^^^^^^^^^^^^^^^
131144 |
132145 = note: the literal `18446744073709551615_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
146+ = help: consider using `u64` instead
133147
134148error: literal out of range for `i64`
135149 --> $DIR/lint-type-overflow.rs:43:19
@@ -138,6 +152,7 @@ LL | let x: i64 = -9223372036854775809;
138152 | ^^^^^^^^^^^^^^^^^^^
139153 |
140154 = note: the literal `9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
155+ = help: consider using `i128` instead
141156
142157error: literal out of range for `i64`
143158 --> $DIR/lint-type-overflow.rs:44:14
@@ -146,6 +161,7 @@ LL | let x = -9223372036854775809_i64;
146161 | ^^^^^^^^^^^^^^^^^^^^^^^
147162 |
148163 = note: the literal `9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
164+ = help: consider using `i128` instead
149165
150166error: aborting due to 18 previous errors
151167
0 commit comments