Only the first line, which is exceeding_bitshifts
, is a hard error and the rest, overflowing_literals
, are just warnings.
fn main() {
println!("{}", 1 << 32);
println!("{}", 5_000_000_000i32);
println!("{}", 5_000_000_000); // i32
println!("{}", 1e1000f32);
println!("{}", 1e1000); // f64
}
Does it not make more sense to turn both of them hard errors? I mean, what are possible use cases of overflowing literals? (Maybe for some macro sorcery?) If some people really mean to have an overflowed value, they can use something like 5_000_000_000u64 as i32
, even within const contexts.