@@ -253,8 +253,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
253253 // only cares about the input argument patterns in the function
254254 // declaration (decl), not the return types.
255255 let asyncness = header. asyncness ;
256- let body_id =
257- this. lower_maybe_async_body ( span, & decl, asyncness, body. as_deref ( ) ) ;
256+ let body_id = this. lower_maybe_async_body (
257+ span,
258+ hir_id,
259+ & decl,
260+ asyncness,
261+ body. as_deref ( ) ,
262+ ) ;
258263
259264 let mut itctx = ImplTraitContext :: Universal ;
260265 let ( generics, decl) = this. lower_generics ( generics, id, & mut itctx, |this| {
@@ -701,6 +706,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
701706
702707 fn lower_trait_item ( & mut self , i : & AssocItem ) -> & ' hir hir:: TraitItem < ' hir > {
703708 let hir_id = self . lower_node_id ( i. id ) ;
709+ self . lower_attrs ( hir_id, & i. attrs ) ;
704710 let trait_item_def_id = hir_id. expect_owner ( ) ;
705711
706712 let ( generics, kind, has_default) = match & i. kind {
@@ -724,7 +730,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
724730 AssocItemKind :: Fn ( box Fn { sig, generics, body : Some ( body) , .. } ) => {
725731 let asyncness = sig. header . asyncness ;
726732 let body_id =
727- self . lower_maybe_async_body ( i. span , & sig. decl , asyncness, Some ( & body) ) ;
733+ self . lower_maybe_async_body ( i. span , hir_id , & sig. decl , asyncness, Some ( & body) ) ;
728734 let ( generics, sig) = self . lower_method_sig (
729735 generics,
730736 sig,
@@ -759,7 +765,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
759765 AssocItemKind :: MacCall ( ..) => panic ! ( "macro item shouldn't exist at this point" ) ,
760766 } ;
761767
762- self . lower_attrs ( hir_id, & i. attrs ) ;
763768 let item = hir:: TraitItem {
764769 owner_id : trait_item_def_id,
765770 ident : self . lower_ident ( i. ident ) ,
@@ -798,6 +803,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
798803 // Since `default impl` is not yet implemented, this is always true in impls.
799804 let has_value = true ;
800805 let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
806+ let hir_id = self . lower_node_id ( i. id ) ;
807+ self . lower_attrs ( hir_id, & i. attrs ) ;
801808
802809 let ( generics, kind) = match & i. kind {
803810 AssocItemKind :: Const ( _, ty, expr) => {
@@ -810,8 +817,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
810817 AssocItemKind :: Fn ( box Fn { sig, generics, body, .. } ) => {
811818 self . current_item = Some ( i. span ) ;
812819 let asyncness = sig. header . asyncness ;
813- let body_id =
814- self . lower_maybe_async_body ( i. span , & sig. decl , asyncness, body. as_deref ( ) ) ;
820+ let body_id = self . lower_maybe_async_body (
821+ i. span ,
822+ hir_id,
823+ & sig. decl ,
824+ asyncness,
825+ body. as_deref ( ) ,
826+ ) ;
815827 let ( generics, sig) = self . lower_method_sig (
816828 generics,
817829 sig,
@@ -844,8 +856,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
844856 AssocItemKind :: MacCall ( ..) => panic ! ( "`TyMac` should have been expanded by now" ) ,
845857 } ;
846858
847- let hir_id = self . lower_node_id ( i. id ) ;
848- self . lower_attrs ( hir_id, & i. attrs ) ;
849859 let item = hir:: ImplItem {
850860 owner_id : hir_id. expect_owner ( ) ,
851861 ident : self . lower_ident ( i. ident ) ,
@@ -978,6 +988,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
978988 fn lower_maybe_async_body (
979989 & mut self ,
980990 span : Span ,
991+ fn_id : hir:: HirId ,
981992 decl : & FnDecl ,
982993 asyncness : Async ,
983994 body : Option < & Block > ,
@@ -1128,6 +1139,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11281139
11291140 let async_expr = this. make_async_expr (
11301141 CaptureBy :: Value ,
1142+ Some ( fn_id) ,
11311143 closure_id,
11321144 None ,
11331145 body. span ,
0 commit comments