]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/too-live-local-in-immovable-gen.rs
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / ui / generator / too-live-local-in-immovable-gen.rs
1 // run-pass
2 #![allow(unused_unsafe)]
3
4 #![feature(generators)]
5
6 fn main() {
7     unsafe {
8         static move || { //~ WARN unused generator that must be used
9             // Tests that the generator transformation finds out that `a` is not live
10             // during the yield expression. Type checking will also compute liveness
11             // and it should also find out that `a` is not live.
12             // The compiler will panic if the generator transformation finds that
13             // `a` is live and type checking finds it dead.
14             let a = {
15                 yield ();
16                 4i32
17             };
18             let _ = &a;
19         };
20     }
21 }