about summary refs log tree commit diff
path: root/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
blob: b7623dc23da1b2cf0388f1084378ebf5291b2e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ test-mir-pass: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

// EMIT_MIR bad_op_mod_by_zero.main.GVN.diff
#[allow(unconditional_panic)]
fn main() {
    // CHECK-LABEL: fn main(
    // CHECK: debug y => [[y:_.*]];
    // CHECK: debug _z => [[z:_.*]];
    // CHECK: assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of
    // zero", const 1_i32)
    // CHECK: assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32)
    // CHECK: [[z]] = Rem(const 1_i32, const 0_i32);
    let y = 0;
    let _z = 1 % y;
}