]> git.proxmox.com Git - rustc.git/blob - src/test/mir-opt/generator-storage-dead-unwind.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / 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 rustc.main-{{closure}}.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 }