Closed
Description
Code
fn main() {
_ = 340282366920938463463374607431768211455;
}
Current output
error: literal out of range for `i32`
--> src/main.rs:2:9
|
2 | _ = 340282366920938463463374607431768211455;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the literal `340282366920938463463374607431768211455` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i8` instead
= note: `#[deny(overflowing_literals)]` on by default
Desired output
error: literal out of range for `i32`
--> src/main.rs:2:9
|
2 | _ = 340282366920938463463374607431768211455;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the literal `340282366920938463463374607431768211455` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `u128` instead
= note: `#[deny(overflowing_literals)]` on by default
Rationale and extra context
The help currently suggest to use a overly small type i8
instead of the only fitting type u128
.
Other cases
Rust Version
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.83.0
LLVM version: 19.1.1
Anything else?
No response