rust/tests/ui/coroutine/live-upvar-across-yield.rs
Oli Scherer aef0f4024a Error on using yield without also using #[coroutine] on the closure
And suggest adding the `#[coroutine]` to the closure
2024-04-24 08:05:29 +00:00

15 lines
248 B
Rust

//@ run-pass
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
let b = |_| 3;
let mut a = #[coroutine] || {
b(yield);
};
Pin::new(&mut a).resume(());
}