Skip to content

Commit

Permalink
Auto merge of #116447 - oli-obk:gen_fn, r=compiler-errors
Browse files Browse the repository at this point in the history
Implement `gen` blocks in the 2024 edition

Coroutines tracking issue rust-lang/rust#43122
`gen` block tracking issue rust-lang/rust#117078

This PR implements `gen` blocks that implement `Iterator`. Most of the logic with `async` blocks is shared, and thus I renamed various types that were referring to `async` specifically.

An example usage of `gen` blocks is

```rust
fn foo() -> impl Iterator<Item = i32> {
    gen {
        yield 42;
        for i in 5..18 {
            if i.is_even() { continue }
            yield i * 2;
        }
    }
}
```

The limitations (to be resolved) of the implementation are listed in the tracking issue
  • Loading branch information
bors committed Oct 29, 2023
2 parents 91a22f5 + 3e693e5 commit 87d1311
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 87d1311

Please sign in to comment.