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