-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsA-mir-opt-inliningArea: MIR inliningArea: MIR inliningC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
leonardo-mscottmcm
Metadata
Metadata
Assignees
Labels
A-mir-optArea: MIR optimizationsArea: MIR optimizationsA-mir-opt-inliningArea: MIR inliningArea: MIR inliningC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.