]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/no-drop-for-inactive-variant.rs
Rollup merge of #100367 - fmease:fix-100365, r=compiler-errors
[rust.git] / src / test / mir-opt / no-drop-for-inactive-variant.rs
1 // ignore-wasm32-bare compiled with panic=abort by default
2
3 // Ensure that there are no drop terminators in `unwrap<T>` (except the one along the cleanup
4 // path).
5
6 // EMIT_MIR no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir
7 fn unwrap<T>(opt: Option<T>) -> T {
8     match opt {
9         Some(x) => x,
10         None => panic!(),
11     }
12 }
13
14 fn main() {
15     let _ = unwrap(Some(1i32));
16 }