1
Fork 0
rust/compiler/rustc_resolve/src
bors 56278a6e28 Auto merge of #118457 - eholk:genfn, r=compiler-errors
Add support for `gen fn`

This builds on #116447 to add support for `gen fn` functions. For the most part we follow the same approach as desugaring `async fn`, but replacing `Future` with `Iterator` and `async {}` with `gen {}` for the body.

The version implemented here uses the return type of a `gen fn` as the yield type. For example:

```rust
gen fn count_to_three() -> i32 {
    yield 1;
    yield 2;
    yield 3;
}
```

In the future, I think we should experiment with a syntax like `gen fn count_to_three() yield i32 { ... }`, but that can go in another PR.

cc `@oli-obk` `@compiler-errors`
2023-12-05 18:37:15 +00:00
..
diagnostics Implement the unused_macro_rules lint 2022-05-05 19:13:00 +02:00
late Dont suggest ! for path in function call if it has generic args 2023-11-27 01:02:37 +00:00
build_reduced_graph.rs merge DefKind::Coroutine into DefKind::Closure 2023-11-26 21:05:08 +08:00
check_unused.rs Rollup merge of #116905 - Fenex:refactor/compiler/resolve, r=petrochenkov 2023-10-26 17:45:43 +02:00
def_collector.rs Option<CoroutineKind> 2023-12-04 13:03:37 -08:00
diagnostics.rs Structured use suggestion on privacy error 2023-12-04 22:26:08 +00:00
effective_visibilities.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
errors.rs Rollup merge of #115744 - fmease:fix-e0401, r=compiler-errors 2023-09-11 17:03:32 +02:00
ident.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
imports.rs Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errors 2023-12-02 02:48:34 +00:00
late.rs Address code review feedback 2023-12-04 14:33:46 -08:00
lib.rs rustc: Harmonize DefKind and DefPathData 2023-12-03 16:24:56 +03:00
macros.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
rustdoc.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00