mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
aef0f4024a
And suggest adding the `#[coroutine]` to the closure
21 lines
426 B
Rust
21 lines
426 B
Rust
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
|
|
|
use std::ops::Coroutine;
|
|
use std::pin::Pin;
|
|
|
|
fn main() {
|
|
let _b = {
|
|
let a = 3;
|
|
Pin::new(&mut #[coroutine] || yield &a).resume(())
|
|
//~^ ERROR: `a` does not live long enough
|
|
};
|
|
|
|
let _b = {
|
|
let a = 3;
|
|
#[coroutine] || {
|
|
yield &a
|
|
//~^ ERROR: `a` does not live long enough
|
|
}
|
|
};
|
|
}
|