rust/tests/ui/coroutine/reborrow-mut-upvar.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

17 lines
241 B
Rust

//@ run-pass
#![feature(coroutines)]
fn _run(bar: &mut i32) {
#[coroutine] || { //~ WARN unused coroutine that must be used
{
let _baz = &*bar;
yield;
}
*bar = 2;
};
}
fn main() {}