@@ -70,7 +70,6 @@ use rustc_middle::{
7070    ty:: { ResolverAstLowering ,  TyCtxt } , 
7171} ; 
7272use  rustc_session:: parse:: { add_feature_diagnostics,  feature_err} ; 
73- use  rustc_span:: hygiene:: MacroKind ; 
7473use  rustc_span:: symbol:: { kw,  sym,  Ident ,  Symbol } ; 
7574use  rustc_span:: { DesugaringKind ,  Span ,  DUMMY_SP } ; 
7675use  smallvec:: SmallVec ; 
@@ -156,7 +155,6 @@ trait ResolverAstLoweringExt {
156155    fn  get_lifetime_res ( & self ,  id :  NodeId )  -> Option < LifetimeRes > ; 
157156    fn  take_extra_lifetime_params ( & mut  self ,  id :  NodeId )  -> Vec < ( Ident ,  NodeId ,  LifetimeRes ) > ; 
158157    fn  remap_extra_lifetime_params ( & mut  self ,  from :  NodeId ,  to :  NodeId ) ; 
159-     fn  decl_macro_kind ( & self ,  def_id :  LocalDefId )  -> MacroKind ; 
160158} 
161159
162160impl  ResolverAstLoweringExt  for  ResolverAstLowering  { 
@@ -220,10 +218,6 @@ impl ResolverAstLoweringExt for ResolverAstLowering {
220218        let  lifetimes = self . extra_lifetime_params_map . remove ( & from) . unwrap_or_default ( ) ; 
221219        self . extra_lifetime_params_map . insert ( to,  lifetimes) ; 
222220    } 
223- 
224-     fn  decl_macro_kind ( & self ,  def_id :  LocalDefId )  -> MacroKind  { 
225-         self . builtin_macro_kinds . get ( & def_id) . copied ( ) . unwrap_or ( MacroKind :: Bang ) 
226-     } 
227221} 
228222
229223/// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree, 
@@ -470,6 +464,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
470464        parent :  LocalDefId , 
471465        node_id :  ast:: NodeId , 
472466        data :  DefPathData , 
467+         def_kind :  DefKind , 
473468        span :  Span , 
474469    )  -> LocalDefId  { 
475470        debug_assert_ne ! ( node_id,  ast:: DUMMY_NODE_ID ) ; 
@@ -481,7 +476,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
481476            self . tcx. hir( ) . def_key( self . local_def_id( node_id) ) , 
482477        ) ; 
483478
484-         let  def_id = self . tcx . at ( span) . create_def ( parent,  data) . def_id ( ) ; 
479+         let  def_id = self . tcx . at ( span) . create_def ( parent,  data,  def_kind ) . def_id ( ) ; 
485480
486481        debug ! ( "create_def: def_id_to_node_id[{:?}] <-> {:?}" ,  def_id,  node_id) ; 
487482        self . resolver . node_id_to_def_id . insert ( node_id,  def_id) ; 
@@ -783,6 +778,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
783778                    self . current_hir_id_owner . def_id , 
784779                    param, 
785780                    DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) , 
781+                     DefKind :: LifetimeParam , 
786782                    ident. span , 
787783                ) ; 
788784                debug ! ( ?_def_id) ; 
@@ -1195,6 +1191,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11951191                                    parent_def_id. def_id , 
11961192                                    node_id, 
11971193                                    DefPathData :: AnonConst , 
1194+                                     DefKind :: AnonConst , 
11981195                                    span, 
11991196                                ) ; 
12001197
@@ -1432,6 +1429,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14321429                            self . current_hir_id_owner . def_id , 
14331430                            * def_node_id, 
14341431                            DefPathData :: TypeNs ( ident. name ) , 
1432+                             DefKind :: TyParam , 
14351433                            span, 
14361434                        ) ; 
14371435                        let  ( param,  bounds,  path)  = self . lower_universal_param_and_bounds ( 
@@ -1585,6 +1583,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15851583            self . current_hir_id_owner . def_id , 
15861584            opaque_ty_node_id, 
15871585            DefPathData :: ImplTrait , 
1586+             DefKind :: OpaqueTy , 
15881587            opaque_ty_span, 
15891588        ) ; 
15901589        debug ! ( ?opaque_ty_def_id) ; 
@@ -1639,6 +1638,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16391638                    opaque_ty_def_id, 
16401639                    duplicated_lifetime_node_id, 
16411640                    DefPathData :: LifetimeNs ( lifetime. ident . name ) , 
1641+                     DefKind :: LifetimeParam , 
16421642                    lifetime. ident . span , 
16431643                ) ; 
16441644                captured_to_synthesized_mapping. insert ( old_def_id,  duplicated_lifetime_def_id) ; 
@@ -2509,8 +2509,13 @@ impl<'hir> GenericArgsCtor<'hir> {
25092509        } ) ; 
25102510        lcx. attrs . insert ( hir_id. local_id ,  std:: slice:: from_ref ( attr) ) ; 
25112511
2512-         let  def_id =
2513-             lcx. create_def ( lcx. current_hir_id_owner . def_id ,  id,  DefPathData :: AnonConst ,  span) ; 
2512+         let  def_id = lcx. create_def ( 
2513+             lcx. current_hir_id_owner . def_id , 
2514+             id, 
2515+             DefPathData :: AnonConst , 
2516+             DefKind :: AnonConst , 
2517+             span, 
2518+         ) ; 
25142519        lcx. children . push ( ( def_id,  hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ; 
25152520        self . args . push ( hir:: GenericArg :: Const ( hir:: ConstArg  { 
25162521            value :  hir:: AnonConst  {  def_id,  hir_id,  body } , 
0 commit comments