rust/tests/ui/generator/nested_generators.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
412 B
Rust
Raw Normal View History

// run-pass
2018-10-04 13:49:38 -05:00
#![feature(generators, generator_trait)]
2018-10-04 13:49:38 -05:00
use std::ops::{Generator, GeneratorState};
use std::pin::Pin;
fn main() {
let _generator = || {
let mut sub_generator = || {
yield 2;
};
match Pin::new(&mut sub_generator).resume(()) {
GeneratorState::Yielded(x) => {
yield x;
}
_ => panic!(),
};
};
}