@@ -70,7 +70,6 @@ use rustc_middle::{
70
70
ty:: { ResolverAstLowering , TyCtxt } ,
71
71
} ;
72
72
use rustc_session:: parse:: { add_feature_diagnostics, feature_err} ;
73
- use rustc_span:: hygiene:: MacroKind ;
74
73
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
75
74
use rustc_span:: { DesugaringKind , Span , DUMMY_SP } ;
76
75
use smallvec:: SmallVec ;
@@ -156,7 +155,6 @@ trait ResolverAstLoweringExt {
156
155
fn get_lifetime_res ( & self , id : NodeId ) -> Option < LifetimeRes > ;
157
156
fn take_extra_lifetime_params ( & mut self , id : NodeId ) -> Vec < ( Ident , NodeId , LifetimeRes ) > ;
158
157
fn remap_extra_lifetime_params ( & mut self , from : NodeId , to : NodeId ) ;
159
- fn decl_macro_kind ( & self , def_id : LocalDefId ) -> MacroKind ;
160
158
}
161
159
162
160
impl ResolverAstLoweringExt for ResolverAstLowering {
@@ -220,10 +218,6 @@ impl ResolverAstLoweringExt for ResolverAstLowering {
220
218
let lifetimes = self . extra_lifetime_params_map . remove ( & from) . unwrap_or_default ( ) ;
221
219
self . extra_lifetime_params_map . insert ( to, lifetimes) ;
222
220
}
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
- }
227
221
}
228
222
229
223
/// 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> {
470
464
parent : LocalDefId ,
471
465
node_id : ast:: NodeId ,
472
466
data : DefPathData ,
467
+ def_kind : DefKind ,
473
468
span : Span ,
474
469
) -> LocalDefId {
475
470
debug_assert_ne ! ( node_id, ast:: DUMMY_NODE_ID ) ;
@@ -481,7 +476,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
481
476
self . tcx. hir( ) . def_key( self . local_def_id( node_id) ) ,
482
477
) ;
483
478
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 ( ) ;
485
480
486
481
debug ! ( "create_def: def_id_to_node_id[{:?}] <-> {:?}" , def_id, node_id) ;
487
482
self . resolver . node_id_to_def_id . insert ( node_id, def_id) ;
@@ -783,6 +778,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
783
778
self . current_hir_id_owner . def_id ,
784
779
param,
785
780
DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
781
+ DefKind :: LifetimeParam ,
786
782
ident. span ,
787
783
) ;
788
784
debug ! ( ?_def_id) ;
@@ -1195,6 +1191,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1195
1191
parent_def_id. def_id ,
1196
1192
node_id,
1197
1193
DefPathData :: AnonConst ,
1194
+ DefKind :: AnonConst ,
1198
1195
span,
1199
1196
) ;
1200
1197
@@ -1432,6 +1429,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1432
1429
self . current_hir_id_owner . def_id ,
1433
1430
* def_node_id,
1434
1431
DefPathData :: TypeNs ( ident. name ) ,
1432
+ DefKind :: TyParam ,
1435
1433
span,
1436
1434
) ;
1437
1435
let ( param, bounds, path) = self . lower_universal_param_and_bounds (
@@ -1585,6 +1583,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1585
1583
self . current_hir_id_owner . def_id ,
1586
1584
opaque_ty_node_id,
1587
1585
DefPathData :: ImplTrait ,
1586
+ DefKind :: OpaqueTy ,
1588
1587
opaque_ty_span,
1589
1588
) ;
1590
1589
debug ! ( ?opaque_ty_def_id) ;
@@ -1639,6 +1638,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1639
1638
opaque_ty_def_id,
1640
1639
duplicated_lifetime_node_id,
1641
1640
DefPathData :: LifetimeNs ( lifetime. ident . name ) ,
1641
+ DefKind :: LifetimeParam ,
1642
1642
lifetime. ident . span ,
1643
1643
) ;
1644
1644
captured_to_synthesized_mapping. insert ( old_def_id, duplicated_lifetime_def_id) ;
@@ -2509,8 +2509,13 @@ impl<'hir> GenericArgsCtor<'hir> {
2509
2509
} ) ;
2510
2510
lcx. attrs . insert ( hir_id. local_id , std:: slice:: from_ref ( attr) ) ;
2511
2511
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
+ ) ;
2514
2519
lcx. children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
2515
2520
self . args . push ( hir:: GenericArg :: Const ( hir:: ConstArg {
2516
2521
value : hir:: AnonConst { def_id, hir_id, body } ,
0 commit comments