rust/tests/mir-opt/const_prop/inherit_overflow.rs

15 lines
493 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ test-mir-pass: GVN
//@ compile-flags: -Zmir-enable-passes=+Inline
2023-02-08 14:28:39 -06:00
2023-12-02 14:31:27 -06:00
// After inlining, this will contain a `CheckedBinaryOp`.
// Propagating the overflow is ok as codegen will just skip emitting the panic.
2023-09-20 16:43:33 -05:00
// EMIT_MIR inherit_overflow.main.GVN.diff
2023-02-08 14:28:39 -06:00
fn main() {
2023-12-02 14:31:27 -06:00
// CHECK-LABEL: fn main(
// CHECK: {{_.*}} = const (0_u8, true);
// CHECK: assert(!const true,
// CHECK: {{_.*}} = const 0_u8;
2023-02-08 14:28:39 -06:00
let _ = <u8 as std::ops::Add>::add(255, 1);
}