@@ -268,8 +268,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
268268 // only cares about the input argument patterns in the function
269269 // declaration (decl), not the return types.
270270 let asyncness = header. asyncness ;
271- let body_id =
272- this. lower_maybe_async_body ( span, & decl, asyncness, body. as_deref ( ) ) ;
271+ let body_id = this. lower_maybe_async_body (
272+ span,
273+ hir_id,
274+ & decl,
275+ asyncness,
276+ body. as_deref ( ) ,
277+ ) ;
273278
274279 let mut itctx = ImplTraitContext :: Universal ;
275280 let ( generics, decl) = this. lower_generics ( generics, id, & mut itctx, |this| {
@@ -789,7 +794,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
789794 AssocItemKind :: Fn ( box Fn { sig, generics, body : Some ( body) , .. } ) => {
790795 let asyncness = sig. header . asyncness ;
791796 let body_id =
792- self . lower_maybe_async_body ( i. span , & sig. decl , asyncness, Some ( & body) ) ;
797+ self . lower_maybe_async_body ( i. span , hir_id , & sig. decl , asyncness, Some ( & body) ) ;
793798 let ( generics, sig) = self . lower_method_sig (
794799 generics,
795800 sig,
@@ -863,6 +868,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
863868 // Since `default impl` is not yet implemented, this is always true in impls.
864869 let has_value = true ;
865870 let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
871+ let hir_id = self . lower_node_id ( i. id ) ;
866872
867873 let ( generics, kind) = match & i. kind {
868874 AssocItemKind :: Const ( _, ty, expr) => {
@@ -875,8 +881,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
875881 AssocItemKind :: Fn ( box Fn { sig, generics, body, .. } ) => {
876882 self . current_item = Some ( i. span ) ;
877883 let asyncness = sig. header . asyncness ;
878- let body_id =
879- self . lower_maybe_async_body ( i. span , & sig. decl , asyncness, body. as_deref ( ) ) ;
884+ let body_id = self . lower_maybe_async_body (
885+ i. span ,
886+ hir_id,
887+ & sig. decl ,
888+ asyncness,
889+ body. as_deref ( ) ,
890+ ) ;
880891 let ( generics, sig) = self . lower_method_sig (
881892 generics,
882893 sig,
@@ -909,7 +920,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
909920 AssocItemKind :: MacCall ( ..) => panic ! ( "`TyMac` should have been expanded by now" ) ,
910921 } ;
911922
912- let hir_id = self . lower_node_id ( i. id ) ;
913923 self . lower_attrs ( hir_id, & i. attrs ) ;
914924 let item = hir:: ImplItem {
915925 owner_id : hir_id. expect_owner ( ) ,
@@ -1043,6 +1053,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10431053 fn lower_maybe_async_body (
10441054 & mut self ,
10451055 span : Span ,
1056+ fn_id : hir:: HirId ,
10461057 decl : & FnDecl ,
10471058 asyncness : Async ,
10481059 body : Option < & Block > ,
@@ -1193,6 +1204,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
11931204
11941205 let async_expr = this. make_async_expr (
11951206 CaptureBy :: Value ,
1207+ Some ( fn_id) ,
11961208 closure_id,
11971209 None ,
11981210 body. span ,
0 commit comments