mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
841184bcae
Also don't recomment recursive_async crate anymore Co-authored-by: lcnr <rust@lcnr.de>
22 lines
469 B
Rust
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();
|
|
}
|