rust/tests/ui/nll/coroutine-upvar-mutability.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
231 B
Rust

// Check that coroutines respect the muatability of their upvars.
#![feature(coroutines)]
fn mutate_upvar() {
let x = 0;
#[coroutine]
move || {
x = 1;
//~^ ERROR
yield;
};
}
fn main() {}