diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-04-13 20:57:42 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-04-13 20:57:44 +0200 |
| commit | 22f6448bed394c65e356ee4132d2d1cc7234078e (patch) | |
| tree | 075c8565932da3216c6d5018f908137da9eb401c | |
| parent | 7953910464e073eb3876d1544a3fd5b5ba0ca49b (diff) | |
| download | rust-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.rs | 14 |
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)) => { |
