]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/no_drop_for_inactive_variant.rs
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
[rust.git] / tests / 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 }