about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-04-13 20:57:42 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-04-13 20:57:44 +0200
commit22f6448bed394c65e356ee4132d2d1cc7234078e (patch)
tree075c8565932da3216c6d5018f908137da9eb401c
parent7953910464e073eb3876d1544a3fd5b5ba0ca49b (diff)
downloadrust-22f6448bed394c65e356ee4132d2d1cc7234078e.tar.gz
rust-22f6448bed394c65e356ee4132d2d1cc7234078e.zip
Lower async fn in traits.
An error is already created by AST validation.
-rw-r--r--compiler/rustc_ast_lowering/src/item.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index ea01632d75d..5fd8f7eb33a 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -836,9 +836,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 (generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(names)))
             }
             AssocItemKind::Fn(box FnKind(_, ref sig, ref generics, Some(ref body))) => {
-                let body_id = self.lower_fn_body_block(i.span, &sig.decl, Some(body));
-                let (generics, sig) =
-                    self.lower_method_sig(generics, sig, trait_item_def_id, false, None, i.id);
+                let asyncness = sig.header.asyncness;
+                let body_id =
+                    self.lower_maybe_async_body(i.span, &sig.decl, asyncness, Some(&body));
+                let (generics, sig) = self.lower_method_sig(
+                    generics,
+                    sig,
+                    trait_item_def_id,
+                    false,
+                    asyncness.opt_return_id(),
+                    i.id,
+                );
                 (generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Provided(body_id)))
             }
             AssocItemKind::TyAlias(box TyAliasKind(_, ref generics, ref bounds, ref default)) => {