diff options
| author | Arpad Borsos <swatinem@swatinem.de> | 2022-11-18 22:56:22 +0100 |
|---|---|---|
| committer | Arpad Borsos <swatinem@swatinem.de> | 2022-11-24 10:04:27 +0100 |
| commit | 9f36f988ad873f5d34cd9c08e4903c597ffc9532 (patch) | |
| tree | 48825cd5da62cbc7f585c6c991a3b8e25d01dd20 /compiler/rustc_resolve/src | |
| parent | fd815a5091eb4d49cd317f8ad272f17b7a5f550d (diff) | |
| download | rust-9f36f988ad873f5d34cd9c08e4903c597ffc9532.tar.gz rust-9f36f988ad873f5d34cd9c08e4903c597ffc9532.zip | |
Avoid `GenFuture` shim when compiling async constructs
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 5072d2aad16..2cc3e410d20 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -3912,7 +3912,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { visit::walk_expr(self, expr); self.diagnostic_metadata.current_type_ascription.pop(); } - // `async |x| ...` gets desugared to `|x| future_from_generator(|| ...)`, so we need to + // `async |x| ...` gets desugared to `|x| async {...}`, so we need to // resolve the arguments within the proper scopes so that usages of them inside the // closure are detected as upvars rather than normal closure arg usages. ExprKind::Closure(box ast::Closure { |
