rust/tests/ui/impl-trait/recursive-coroutine-boxed.rs
Michael Goulet 841184bcae Make cycle error more resilient to where it starts
Also don't recomment recursive_async crate anymore

Co-authored-by: lcnr <rust@lcnr.de>
2024-01-08 20:30:24 +00:00

22 lines
469 B
Rust

// check-pass
// revisions: current next
//[next] compile-flags: -Znext-solver
#![feature(coroutines, coroutine_trait)]
use std::ops::{Coroutine, CoroutineState};
fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|| {
let mut gen = Box::pin(foo());
let mut r = gen.as_mut().resume(());
while let CoroutineState::Yielded(v) = r {
yield v;
r = gen.as_mut().resume(());
}
}
}
fn main() {
foo();
}