2023-10-19 21:46:28 +00:00
|
|
|
#![feature(coroutines, coroutine_trait)]
|
2017-07-07 16:12:44 -07:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
use std::ops::Coroutine;
|
2018-10-04 20:49:38 +02:00
|
|
|
use std::pin::Pin;
|
2017-07-07 16:12:44 -07:00
|
|
|
|
2018-04-16 12:41:32 +02:00
|
|
|
fn main() {
|
2017-07-07 16:12:44 -07:00
|
|
|
let _b = {
|
|
|
|
let a = 3;
|
2020-01-25 20:03:10 +01:00
|
|
|
Pin::new(&mut || yield &a).resume(())
|
2017-07-07 16:12:44 -07:00
|
|
|
//~^ ERROR: `a` does not live long enough
|
|
|
|
};
|
|
|
|
|
|
|
|
let _b = {
|
|
|
|
let a = 3;
|
|
|
|
|| {
|
|
|
|
yield &a
|
|
|
|
//~^ ERROR: `a` does not live long enough
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|