2024-04-11 13:15:34 +00:00
|
|
|
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
2017-07-07 23:12:44 +00:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
use std::ops::Coroutine;
|
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;
|
2024-04-11 13:15:34 +00:00
|
|
|
Pin::new(&mut #[coroutine] || yield &a).resume(())
|
2017-07-07 23:12:44 +00:00
|
|
|
//~^ ERROR: `a` does not live long enough
|
|
|
|
};
|
|
|
|
|
|
|
|
let _b = {
|
|
|
|
let a = 3;
|
2024-04-11 13:15:34 +00:00
|
|
|
#[coroutine] || {
|
2017-07-07 23:12:44 +00:00
|
|
|
yield &a
|
|
|
|
//~^ ERROR: `a` does not live long enough
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|