rust/tests/ui/nll/issue-48623-coroutine.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

19 lines
347 B
Rust

//@ run-pass
#![allow(path_statements)]
#![allow(dead_code)]
#![feature(coroutines, coroutine_trait)]
struct WithDrop;
impl Drop for WithDrop {
fn drop(&mut self) {}
}
fn reborrow_from_coroutine(r: &mut ()) {
let d = WithDrop;
#[coroutine] move || { d; yield; &mut *r }; //~ WARN unused coroutine that must be used
}
fn main() {}