2023-09-20 16:43:33 -05:00
|
|
|
//@ unit-test: GVN
|
2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2023-12-02 14:17:49 -06:00
|
|
|
|
2023-09-20 16:43:33 -05:00
|
|
|
// EMIT_MIR bad_op_mod_by_zero.main.GVN.diff
|
2020-04-27 17:57:58 -05:00
|
|
|
#[allow(unconditional_panic)]
|
|
|
|
fn main() {
|
2023-12-02 14:17:49 -06:00
|
|
|
// 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);
|
2020-04-27 17:57:58 -05:00
|
|
|
let y = 0;
|
|
|
|
let _z = 1 % y;
|
|
|
|
}
|