@@ -39,7 +39,6 @@ use rustc_ast::node_id::NodeMap;
3939use rustc_ast:: token:: { self , Token } ;
4040use rustc_ast:: tokenstream:: { CanSynthesizeMissingTokens , TokenStream , TokenTree } ;
4141use rustc_ast:: visit:: { self , AssocCtxt , Visitor } ;
42- use rustc_ast:: walk_list;
4342use rustc_ast:: { self as ast, * } ;
4443use rustc_ast_pretty:: pprust;
4544use rustc_data_structures:: captures:: Captures ;
@@ -48,7 +47,7 @@ use rustc_data_structures::sync::Lrc;
4847use rustc_errors:: { struct_span_err, Applicability } ;
4948use rustc_hir as hir;
5049use 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 } ;
5251use rustc_hir:: definitions:: { DefKey , DefPathData , Definitions } ;
5352use rustc_hir:: intravisit;
5453use rustc_hir:: { ConstArg , GenericArg , InferKind , ParamName } ;
@@ -159,8 +158,6 @@ struct LoweringContext<'a, 'hir: 'a> {
159158
160159 current_module : LocalDefId ,
161160
162- type_def_lifetime_params : DefIdMap < usize > ,
163-
164161 current_hir_id_owner : ( LocalDefId , u32 ) ,
165162 item_local_id_counters : NodeMap < u32 > ,
166163 node_id_to_hir_id : IndexVec < NodeId , Option < hir:: HirId > > ,
@@ -172,7 +169,7 @@ struct LoweringContext<'a, 'hir: 'a> {
172169pub trait ResolverAstLowering {
173170 fn def_key ( & mut self , id : DefId ) -> DefKey ;
174171
175- fn item_generics_num_lifetimes ( & self , def : DefId , sess : & Session ) -> usize ;
172+ fn item_generics_num_lifetimes ( & self , def : DefId ) -> usize ;
176173
177174 fn legacy_const_generic_args ( & mut self , expr : & Expr ) -> Option < Vec < usize > > ;
178175
@@ -336,7 +333,6 @@ pub fn lower_crate<'a, 'hir>(
336333 is_in_trait_impl : false ,
337334 is_in_dyn_type : false ,
338335 anonymous_lifetime_mode : AnonymousLifetimeMode :: PassThrough ,
339- type_def_lifetime_params : Default :: default ( ) ,
340336 current_module : CRATE_DEF_ID ,
341337 current_hir_id_owner : ( CRATE_DEF_ID , 0 ) ,
342338 item_local_id_counters : Default :: default ( ) ,
@@ -452,26 +448,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
452448 fn visit_item ( & mut self , item : & ' tcx Item ) {
453449 self . lctx . allocate_hir_id_counter ( item. id ) ;
454450
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) ;
475453 }
476454
477455 visit:: walk_item ( self , item) ;
@@ -486,23 +464,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
486464 self . lctx . allocate_hir_id_counter ( item. id ) ;
487465 visit:: walk_foreign_item ( self , item) ;
488466 }
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- }
506467 }
507468
508469 self . lower_node_id ( CRATE_NODE_ID ) ;
0 commit comments