@@ -67,6 +67,7 @@ use rustc_middle::{
67
67
ty:: { ResolverAstLowering , TyCtxt } ,
68
68
} ;
69
69
use rustc_session:: parse:: { add_feature_diagnostics, feature_err} ;
70
+ use rustc_span:: hygiene:: MacroKind ;
70
71
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
71
72
use rustc_span:: { DesugaringKind , Span , DUMMY_SP } ;
72
73
use smallvec:: SmallVec ;
@@ -152,6 +153,7 @@ trait ResolverAstLoweringExt {
152
153
fn get_lifetime_res ( & self , id : NodeId ) -> Option < LifetimeRes > ;
153
154
fn take_extra_lifetime_params ( & mut self , id : NodeId ) -> Vec < ( Ident , NodeId , LifetimeRes ) > ;
154
155
fn remap_extra_lifetime_params ( & mut self , from : NodeId , to : NodeId ) ;
156
+ fn decl_macro_kind ( & self , def_id : LocalDefId ) -> MacroKind ;
155
157
}
156
158
157
159
impl ResolverAstLoweringExt for ResolverAstLowering {
@@ -215,6 +217,10 @@ impl ResolverAstLoweringExt for ResolverAstLowering {
215
217
let lifetimes = self . extra_lifetime_params_map . remove ( & from) . unwrap_or_default ( ) ;
216
218
self . extra_lifetime_params_map . insert ( to, lifetimes) ;
217
219
}
220
+
221
+ fn decl_macro_kind ( & self , def_id : LocalDefId ) -> MacroKind {
222
+ self . builtin_macro_kinds . get ( & def_id) . copied ( ) . unwrap_or ( MacroKind :: Bang )
223
+ }
218
224
}
219
225
220
226
/// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree,
@@ -461,7 +467,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
461
467
parent : LocalDefId ,
462
468
node_id : ast:: NodeId ,
463
469
data : DefPathData ,
464
- def_kind : DefKind ,
465
470
span : Span ,
466
471
) -> LocalDefId {
467
472
debug_assert_ne ! ( node_id, ast:: DUMMY_NODE_ID ) ;
@@ -473,7 +478,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
473
478
self . tcx. hir( ) . def_key( self . local_def_id( node_id) ) ,
474
479
) ;
475
480
476
- let def_id = self . tcx . at ( span) . create_def ( parent, data, def_kind ) . def_id ( ) ;
481
+ let def_id = self . tcx . at ( span) . create_def ( parent, data) . def_id ( ) ;
477
482
478
483
debug ! ( "create_def: def_id_to_node_id[{:?}] <-> {:?}" , def_id, node_id) ;
479
484
self . resolver . node_id_to_def_id . insert ( node_id, def_id) ;
@@ -775,7 +780,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
775
780
self . current_hir_id_owner . def_id ,
776
781
param,
777
782
DefPathData :: LifetimeNs ( kw:: UnderscoreLifetime ) ,
778
- DefKind :: LifetimeParam ,
779
783
ident. span ,
780
784
) ;
781
785
debug ! ( ?_def_id) ;
@@ -1188,7 +1192,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1188
1192
parent_def_id. def_id ,
1189
1193
node_id,
1190
1194
DefPathData :: AnonConst ,
1191
- DefKind :: AnonConst ,
1192
1195
span,
1193
1196
) ;
1194
1197
@@ -1426,7 +1429,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1426
1429
self . current_hir_id_owner . def_id ,
1427
1430
* def_node_id,
1428
1431
DefPathData :: TypeNs ( ident. name ) ,
1429
- DefKind :: TyParam ,
1430
1432
span,
1431
1433
) ;
1432
1434
let ( param, bounds, path) = self . lower_universal_param_and_bounds (
@@ -1580,7 +1582,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1580
1582
self . current_hir_id_owner . def_id ,
1581
1583
opaque_ty_node_id,
1582
1584
DefPathData :: ImplTrait ,
1583
- DefKind :: OpaqueTy ,
1584
1585
opaque_ty_span,
1585
1586
) ;
1586
1587
debug ! ( ?opaque_ty_def_id) ;
@@ -1635,7 +1636,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1635
1636
opaque_ty_def_id,
1636
1637
duplicated_lifetime_node_id,
1637
1638
DefPathData :: LifetimeNs ( lifetime. ident . name ) ,
1638
- DefKind :: LifetimeParam ,
1639
1639
lifetime. ident . span ,
1640
1640
) ;
1641
1641
captured_to_synthesized_mapping. insert ( old_def_id, duplicated_lifetime_def_id) ;
@@ -2505,13 +2505,8 @@ impl<'hir> GenericArgsCtor<'hir> {
2505
2505
} ) ;
2506
2506
lcx. attrs . insert ( hir_id. local_id , std:: slice:: from_ref ( attr) ) ;
2507
2507
2508
- let def_id = lcx. create_def (
2509
- lcx. current_hir_id_owner . def_id ,
2510
- id,
2511
- DefPathData :: AnonConst ,
2512
- DefKind :: AnonConst ,
2513
- span,
2514
- ) ;
2508
+ let def_id =
2509
+ lcx. create_def ( lcx. current_hir_id_owner . def_id , id, DefPathData :: AnonConst , span) ;
2515
2510
lcx. children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
2516
2511
self . args . push ( hir:: GenericArg :: Const ( hir:: ConstArg {
2517
2512
value : hir:: AnonConst { def_id, hir_id, body } ,
0 commit comments