Open
Description
I tried this code with -Z mir-opt-level=2
:
fn main() {
println!("{}", 1_u32.wrapping_sub(2_u32));
}
It compiles and runs without mir-opt, but with -Z mir-opt-level=2
or above I get:
error: this arithmetic operation will overflow
--> src/main.rs:2:13
|
2 | println!("{}", 1_u32.wrapping_sub(2_u32));
| ^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 - 2_u32`, which would overflow
|
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (0148b971c 2021-02-18)
binary: rustc
commit-hash: 0148b971c921a0831fbf3357e5936eec724e3566
commit-date: 2021-02-18
host: x86_64-apple-darwin
release: 1.52.0-nightly
LLVM version: 11.0.1