2022-07-26 19:04:27 +02:00
|
|
|
// unit-test: ConstProp
|
2023-12-02 20:17:37 +00:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
|
|
|
|
2020-07-27 21:22:43 +02:00
|
|
|
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
|
2020-04-27 18:57:58 -04:00
|
|
|
#[allow(unconditional_panic)]
|
|
|
|
fn main() {
|
2023-12-02 20:17:37 +00:00
|
|
|
// 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);
|
2020-04-27 18:57:58 -04:00
|
|
|
let y = 0;
|
|
|
|
let _z = 1 / y;
|
|
|
|
}
|