]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/yield-in-initializer.rs
Auto merge of #102655 - joboet:windows_tls_opt, r=ChrisDenton
[rust.git] / src / test / ui / generator / yield-in-initializer.rs
1 // run-pass
2
3 #![feature(generators)]
4
5 fn main() {
6     static || { //~ WARN unused generator that must be used
7         loop {
8             // Test that `opt` is not live across the yield, even when borrowed in a loop
9             // See https://github.com/rust-lang/rust/issues/52792
10             let opt = {
11                 yield;
12                 true
13             };
14             let _ = &opt;
15         }
16     };
17 }