os-rust/tests/ui/coroutine/gen_fn_iter.rs

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

19 lines
344 B
Rust
Raw Normal View History

2023-11-30 11:20:53 -08:00
// edition: 2024
// compile-flags: -Zunstable-options
// run-pass
#![feature(gen_blocks)]
gen fn foo() -> i32 {
yield 1;
yield 2;
yield 3;
}
fn main() {
let mut iter = foo();
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), Some(3));
assert_eq!(iter.next(), None);
}