@@ -3,6 +3,7 @@ use super::ResolverAstLoweringExt;
3
3
use super :: { Arena , AstOwner , ImplTraitContext , ImplTraitPosition } ;
4
4
use super :: { FnDeclKind , LoweringContext , ParamMode } ;
5
5
6
+ use hir:: HirId ;
6
7
use rustc_ast:: ptr:: P ;
7
8
use rustc_ast:: visit:: AssocCtxt ;
8
9
use rustc_ast:: * ;
@@ -269,7 +270,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
269
270
// declaration (decl), not the return types.
270
271
let asyncness = header. asyncness ;
271
272
let body_id =
272
- this. lower_maybe_async_body ( span, & decl, asyncness, body. as_deref ( ) ) ;
273
+ this. lower_maybe_async_body ( span, hir_id , & decl, asyncness, body. as_deref ( ) ) ;
273
274
274
275
let mut itctx = ImplTraitContext :: Universal ;
275
276
let ( generics, decl) = this. lower_generics ( generics, id, & mut itctx, |this| {
@@ -781,6 +782,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
781
782
782
783
fn lower_trait_item ( & mut self , i : & AssocItem ) -> & ' hir hir:: TraitItem < ' hir > {
783
784
let hir_id = self . lower_node_id ( i. id ) ;
785
+ self . lower_attrs ( hir_id, & i. attrs ) ;
784
786
let trait_item_def_id = hir_id. expect_owner ( ) ;
785
787
786
788
let ( generics, kind, has_default) = match i. kind {
@@ -804,7 +806,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
804
806
AssocItemKind :: Fn ( box Fn { ref sig, ref generics, body : Some ( ref body) , .. } ) => {
805
807
let asyncness = sig. header . asyncness ;
806
808
let body_id =
807
- self . lower_maybe_async_body ( i. span , & sig. decl , asyncness, Some ( & body) ) ;
809
+ self . lower_maybe_async_body ( i. span , hir_id , & sig. decl , asyncness, Some ( & body) ) ;
808
810
let ( generics, sig) = self . lower_method_sig (
809
811
generics,
810
812
sig,
@@ -845,7 +847,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
845
847
AssocItemKind :: MacCall ( ..) => panic ! ( "macro item shouldn't exist at this point" ) ,
846
848
} ;
847
849
848
- self . lower_attrs ( hir_id, & i. attrs ) ;
849
850
let item = hir:: TraitItem {
850
851
owner_id : trait_item_def_id,
851
852
ident : self . lower_ident ( i. ident ) ,
@@ -884,6 +885,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
884
885
// Since `default impl` is not yet implemented, this is always true in impls.
885
886
let has_value = true ;
886
887
let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
888
+ let hir_id = self . lower_node_id ( i. id ) ;
889
+ self . lower_attrs ( hir_id, & i. attrs ) ;
887
890
888
891
let ( generics, kind) = match & i. kind {
889
892
AssocItemKind :: Const ( _, ty, expr) => {
@@ -897,7 +900,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
897
900
self . current_item = Some ( i. span ) ;
898
901
let asyncness = sig. header . asyncness ;
899
902
let body_id =
900
- self . lower_maybe_async_body ( i. span , & sig. decl , asyncness, body. as_deref ( ) ) ;
903
+ self . lower_maybe_async_body ( i. span , hir_id , & sig. decl , asyncness, body. as_deref ( ) ) ;
901
904
let ( generics, sig) = self . lower_method_sig (
902
905
generics,
903
906
sig,
@@ -930,8 +933,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
930
933
AssocItemKind :: MacCall ( ..) => panic ! ( "`TyMac` should have been expanded by now" ) ,
931
934
} ;
932
935
933
- let hir_id = self . lower_node_id ( i. id ) ;
934
- self . lower_attrs ( hir_id, & i. attrs ) ;
935
936
let item = hir:: ImplItem {
936
937
owner_id : hir_id. expect_owner ( ) ,
937
938
ident : self . lower_ident ( i. ident ) ,
@@ -1064,6 +1065,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1064
1065
fn lower_maybe_async_body (
1065
1066
& mut self ,
1066
1067
span : Span ,
1068
+ hir_id : HirId ,
1067
1069
decl : & FnDecl ,
1068
1070
asyncness : Async ,
1069
1071
body : Option < & Block > ,
@@ -1215,6 +1217,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1215
1217
let async_expr = this. make_async_expr (
1216
1218
CaptureBy :: Value ,
1217
1219
closure_id,
1220
+ Some ( hir_id) ,
1218
1221
None ,
1219
1222
body. span ,
1220
1223
hir:: AsyncGeneratorKind :: Fn ,
0 commit comments