rust/tests/ui/impl-trait/issues/issue-58504.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

13 lines
338 B
Rust

#![feature(coroutines, coroutine_trait, never_type)]
use std::ops::Coroutine;
fn mk_gen() -> impl Coroutine<Return=!, Yield=()> {
#[coroutine] || { loop { yield; } }
}
fn main() {
let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
//~^ `impl Trait` is not allowed in the type of variable bindings
}