]> git.lizzy.rs Git - rust.git/blob - tests/ui/const_prop/ice-assert-fail-div-by-zero.rs
Rollup merge of #107615 - notriddle:notriddle/nbsp, r=GuillaumeGomez
[rust.git] / tests / ui / const_prop / ice-assert-fail-div-by-zero.rs
1 // check-pass
2
3 // need to emit MIR, because const prop (which emits `unconditional_panic`) only runs if
4 // the `optimized_mir` query is run, which it isn't in check-only mode.
5 // compile-flags: --crate-type lib --emit=mir,link
6
7 #![warn(unconditional_panic)]
8
9 pub struct Fixed64(i64);
10
11 // HACK: this test passes only because this is a const fn that is written to metadata
12 pub const fn div(f: Fixed64) {
13     f.0 / 0; //~ WARN will panic at runtime
14 }