rust/tests/ui/coroutine/nested_coroutine.rs
2024-02-16 20:02:50 +00:00

22 lines
413 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!(),
};
};
}