]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/borrowing.rs
Auto merge of #102655 - joboet:windows_tls_opt, r=ChrisDenton
[rust.git] / src / test / ui / generator / borrowing.rs
1 #![feature(generators, generator_trait)]
2
3 use std::ops::Generator;
4 use std::pin::Pin;
5
6 fn main() {
7     let _b = {
8         let a = 3;
9         Pin::new(&mut || yield &a).resume(())
10         //~^ ERROR: `a` does not live long enough
11     };
12
13     let _b = {
14         let a = 3;
15         || {
16             yield &a
17             //~^ ERROR: `a` does not live long enough
18         }
19     };
20 }