2018-04-16 05:41:32 -05:00
|
|
|
#![feature(generators, generator_trait)]
|
2017-07-07 18:12:44 -05:00
|
|
|
|
2017-07-20 01:07:58 -05:00
|
|
|
use std::ops::Generator;
|
2018-10-04 13:49:38 -05:00
|
|
|
use std::pin::Pin;
|
2017-07-07 18:12:44 -05:00
|
|
|
|
2018-04-16 05:41:32 -05:00
|
|
|
fn main() {
|
2017-07-07 18:12:44 -05:00
|
|
|
let _b = {
|
|
|
|
let a = 3;
|
2020-01-25 13:03:10 -06:00
|
|
|
Pin::new(&mut || yield &a).resume(())
|
2017-07-07 18:12:44 -05:00
|
|
|
//~^ ERROR: `a` does not live long enough
|
|
|
|
};
|
|
|
|
|
|
|
|
let _b = {
|
|
|
|
let a = 3;
|
|
|
|
|| {
|
|
|
|
yield &a
|
|
|
|
//~^ ERROR: `a` does not live long enough
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|