rust/tests/ui/coroutine/nested_coroutine.rs
2023-10-20 21:14:02 +00:00

22 lines
412 B
Rust

// run-pass
#![feature(coroutines, coroutine_trait)]
use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn main() {
let _coroutine = || {
let mut sub_coroutine = || {
yield 2;
};
match Pin::new(&mut sub_coroutine).resume(()) {
CoroutineState::Yielded(x) => {
yield x;
}
_ => panic!(),
};
};
}