@@ -39,7 +39,6 @@ use rustc_ast::node_id::NodeMap;
39
39
use rustc_ast:: token:: { self , Token } ;
40
40
use rustc_ast:: tokenstream:: { CanSynthesizeMissingTokens , TokenStream , TokenTree } ;
41
41
use rustc_ast:: visit:: { self , AssocCtxt , Visitor } ;
42
- use rustc_ast:: walk_list;
43
42
use rustc_ast:: { self as ast, * } ;
44
43
use rustc_ast_pretty:: pprust;
45
44
use rustc_data_structures:: captures:: Captures ;
@@ -48,7 +47,7 @@ use rustc_data_structures::sync::Lrc;
48
47
use rustc_errors:: { struct_span_err, Applicability } ;
49
48
use rustc_hir as hir;
50
49
use rustc_hir:: def:: { DefKind , Namespace , PartialRes , PerNS , Res } ;
51
- use rustc_hir:: def_id:: { DefId , DefIdMap , DefPathHash , LocalDefId , CRATE_DEF_ID } ;
50
+ use rustc_hir:: def_id:: { DefId , DefPathHash , LocalDefId , CRATE_DEF_ID } ;
52
51
use rustc_hir:: definitions:: { DefKey , DefPathData , Definitions } ;
53
52
use rustc_hir:: intravisit;
54
53
use rustc_hir:: { ConstArg , GenericArg , InferKind , ParamName } ;
@@ -159,8 +158,6 @@ struct LoweringContext<'a, 'hir: 'a> {
159
158
160
159
current_module : LocalDefId ,
161
160
162
- type_def_lifetime_params : DefIdMap < usize > ,
163
-
164
161
current_hir_id_owner : ( LocalDefId , u32 ) ,
165
162
item_local_id_counters : NodeMap < u32 > ,
166
163
node_id_to_hir_id : IndexVec < NodeId , Option < hir:: HirId > > ,
@@ -172,7 +169,7 @@ struct LoweringContext<'a, 'hir: 'a> {
172
169
pub trait ResolverAstLowering {
173
170
fn def_key ( & mut self , id : DefId ) -> DefKey ;
174
171
175
- fn item_generics_num_lifetimes ( & self , def : DefId , sess : & Session ) -> usize ;
172
+ fn item_generics_num_lifetimes ( & self , def : DefId ) -> usize ;
176
173
177
174
fn legacy_const_generic_args ( & mut self , expr : & Expr ) -> Option < Vec < usize > > ;
178
175
@@ -336,7 +333,6 @@ pub fn lower_crate<'a, 'hir>(
336
333
is_in_trait_impl : false ,
337
334
is_in_dyn_type : false ,
338
335
anonymous_lifetime_mode : AnonymousLifetimeMode :: PassThrough ,
339
- type_def_lifetime_params : Default :: default ( ) ,
340
336
current_module : CRATE_DEF_ID ,
341
337
current_hir_id_owner : ( CRATE_DEF_ID , 0 ) ,
342
338
item_local_id_counters : Default :: default ( ) ,
@@ -452,26 +448,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
452
448
fn visit_item ( & mut self , item : & ' tcx Item ) {
453
449
self . lctx . allocate_hir_id_counter ( item. id ) ;
454
450
455
- match item. kind {
456
- ItemKind :: Struct ( _, ref generics)
457
- | ItemKind :: Union ( _, ref generics)
458
- | ItemKind :: Enum ( _, ref generics)
459
- | ItemKind :: TyAlias ( box TyAliasKind ( _, ref generics, ..) )
460
- | ItemKind :: Trait ( box TraitKind ( _, _, ref generics, ..) ) => {
461
- let def_id = self . lctx . resolver . local_def_id ( item. id ) ;
462
- let count = generics
463
- . params
464
- . iter ( )
465
- . filter ( |param| {
466
- matches ! ( param. kind, ast:: GenericParamKind :: Lifetime { .. } )
467
- } )
468
- . count ( ) ;
469
- self . lctx . type_def_lifetime_params . insert ( def_id. to_def_id ( ) , count) ;
470
- }
471
- ItemKind :: Use ( ref use_tree) => {
472
- self . allocate_use_tree_hir_id_counters ( use_tree) ;
473
- }
474
- _ => { }
451
+ if let ItemKind :: Use ( ref use_tree) = item. kind {
452
+ self . allocate_use_tree_hir_id_counters ( use_tree) ;
475
453
}
476
454
477
455
visit:: walk_item ( self , item) ;
@@ -486,23 +464,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
486
464
self . lctx . allocate_hir_id_counter ( item. id ) ;
487
465
visit:: walk_foreign_item ( self , item) ;
488
466
}
489
-
490
- fn visit_ty ( & mut self , t : & ' tcx Ty ) {
491
- match t. kind {
492
- // Mirrors the case in visit::walk_ty
493
- TyKind :: BareFn ( ref f) => {
494
- walk_list ! ( self , visit_generic_param, & f. generic_params) ;
495
- // Mirrors visit::walk_fn_decl
496
- for parameter in & f. decl . inputs {
497
- // We don't lower the ids of argument patterns
498
- self . visit_pat ( & parameter. pat ) ;
499
- self . visit_ty ( & parameter. ty )
500
- }
501
- self . visit_fn_ret_ty ( & f. decl . output )
502
- }
503
- _ => visit:: walk_ty ( self , t) ,
504
- }
505
- }
506
467
}
507
468
508
469
self . lower_node_id ( CRATE_NODE_ID ) ;
0 commit comments