Skip to content

Commit

Permalink
FileCheck bad_op_div_by_zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 2, 2023
1 parent 9f01d9d commit 0d5bc87
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/mir-opt/const_prop/bad_op_div_by_zero.rs
Original file line number Diff line number Diff line change
@@ -1,9 1,15 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY

// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
#[allow(unconditional_panic)]
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug y => [[y:_.*]];
// CHECK: debug _z => [[z:_.*]];
// CHECK: assert(!const true, "attempt to divide `{}` by zero", const 1_i32)
// CHECK: assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32)
// CHECK: [[z]] = Div(const 1_i32, const 0_i32);
let y = 0;
let _z = 1 / y;
}

0 comments on commit 0d5bc87

Please sign in to comment.