]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/generator_storage_dead_unwind.rs
Rollup merge of #106709 - khuey:disable_split_dwarf_inlining_by_default, r=davidtwco
[rust.git] / tests / mir-opt / generator_storage_dead_unwind.rs
1 // ignore-wasm32-bare compiled with panic=abort by default
2
3 // Test that we generate StorageDead on unwind paths for generators.
4 //
5 // Basic block and local names can safely change, but the StorageDead statements
6 // should not go away.
7
8 #![feature(generators, generator_trait)]
9
10 struct Foo(i32);
11
12 impl Drop for Foo {
13     fn drop(&mut self) {}
14 }
15
16 struct Bar(i32);
17
18 fn take<T>(_x: T) {}
19
20 // EMIT_MIR generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
21 fn main() {
22     let _gen = || {
23         let a = Foo(5);
24         let b = Bar(6);
25         yield;
26         take(a);
27         take(b);
28     };
29 }