rust/src
bors f967532a47 Auto merge of #118420 - compiler-errors:async-gen, r=eholk
Introduce support for `async gen` blocks

I'm delighted to demonstrate that `async gen` block are not very difficult to support. They're simply coroutines that yield `Poll<Option<T>>` and return `()`.

**This PR is WIP and in draft mode for now** -- I'm mostly putting it up to show folks that it's possible. This PR needs a lang-team experiment associated with it or possible an RFC, since I don't think it falls under the jurisdiction of the `gen` RFC that was recently authored by oli (https://github.com/rust-lang/rfcs/pull/3513, https://github.com/rust-lang/rust/issues/117078).

### Technical note on the pre-generator-transform yield type:

The reason that the underlying coroutines yield `Poll<Option<T>>` and not `Poll<T>` (which would make more sense, IMO, for the pre-transformed coroutine), is because the `TransformVisitor` that is used to turn coroutines into built-in state machine functions would have to destructure and reconstruct the latter into the former, which requires at least inserting a new basic block (for a `switchInt` terminator, to match on the `Poll` discriminant).

This does mean that the desugaring (at the `rustc_ast_lowering` level) of `async gen` blocks is a bit more involved. However, since we already need to intercept both `.await` and `yield` operators, I don't consider it much of a technical burden.

r? `@ghost`
2023-12-08 19:13:57 +00:00
..
bootstrap Auto merge of #118301 - weihanglo:rustfix-doc, r=albertlarsan68 2023-12-08 05:11:12 +00:00
ci Auto merge of #118463 - cuviper:restore-cg_gcc-ci, r=cuviper,GuillaumeGomez 2023-12-07 09:57:44 +00:00
doc Auto merge of #116565 - Sword-Destiny:master, r=Amanieu 2023-12-07 05:22:21 +00:00
etc Auto merge of #115274 - bjorn3:tidy_improvements, r=davidtwco 2023-11-04 02:28:17 +00:00
librustdoc Rollup merge of #118722 - notriddle:notriddle/dom-opt-3, r=GuillaumeGomez 2023-12-08 06:44:44 +01:00
llvm-project@7738295178 Update to LLVM 17.0.5 2023-11-14 12:06:30 +01:00
rustdoc-json-types rustdoc-json: Rename typedef to type alias 2023-08-21 14:02:34 -07:00
tools Auto merge of #118420 - compiler-errors:async-gen, r=eholk 2023-12-08 19:13:57 +00:00
README.md Remove stale reference to the test suite location 2023-01-13 11:49:06 +00:00
stage0.json Bump stage0 to latest 2023-11-15 19:40:51 -05:00
version Bump nightly version 2023-11-11 11:29:33 -05:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.