@@ -15,7 +15,6 @@ use rustc_hir::def_id::LocalDefId;
1515use rustc_hir:: intravisit:: { self , Visitor } ;
1616use rustc_hir:: { GenericArg , GenericParam , GenericParamKind , HirIdMap , LifetimeName , Node } ;
1717use rustc_middle:: bug;
18- use rustc_middle:: hir:: map:: Map ;
1918use rustc_middle:: hir:: nested_filter;
2019use rustc_middle:: middle:: resolve_lifetime:: * ;
2120use rustc_middle:: ty:: { self , DefIdTree , TyCtxt , TypeSuperVisitable , TypeVisitor } ;
@@ -25,30 +24,28 @@ use rustc_span::Span;
2524use std:: fmt;
2625
2726trait RegionExt {
28- fn early ( hir_map : Map < ' _ > , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) ;
27+ fn early ( param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) ;
2928
30- fn late ( index : u32 , hir_map : Map < ' _ > , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) ;
29+ fn late ( index : u32 , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) ;
3130
3231 fn id ( & self ) -> Option < DefId > ;
3332
3433 fn shifted ( self , amount : u32 ) -> Region ;
3534}
3635
3736impl RegionExt for Region {
38- fn early ( hir_map : Map < ' _ > , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) {
39- let def_id = hir_map. local_def_id ( param. hir_id ) ;
40- debug ! ( "Region::early: def_id={:?}" , def_id) ;
41- ( def_id, Region :: EarlyBound ( def_id. to_def_id ( ) ) )
37+ fn early ( param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) {
38+ debug ! ( "Region::early: def_id={:?}" , param. def_id) ;
39+ ( param. def_id , Region :: EarlyBound ( param. def_id . to_def_id ( ) ) )
4240 }
4341
44- fn late ( idx : u32 , hir_map : Map < ' _ > , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) {
42+ fn late ( idx : u32 , param : & GenericParam < ' _ > ) -> ( LocalDefId , Region ) {
4543 let depth = ty:: INNERMOST ;
46- let def_id = hir_map. local_def_id ( param. hir_id ) ;
4744 debug ! (
4845 "Region::late: idx={:?}, param={:?} depth={:?} def_id={:?}" ,
49- idx, param, depth, def_id,
46+ idx, param, depth, param . def_id,
5047 ) ;
51- ( def_id, Region :: LateBound ( depth, idx, def_id. to_def_id ( ) ) )
48+ ( param . def_id , Region :: LateBound ( depth, idx, param . def_id . to_def_id ( ) ) )
5249 }
5350
5451 fn id ( & self ) -> Option < DefId > {
@@ -395,7 +392,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
395392 . filter ( |param| matches ! ( param. kind, GenericParamKind :: Lifetime { .. } ) )
396393 . enumerate ( )
397394 . map ( |( late_bound_idx, param) | {
398- let pair = Region :: late ( late_bound_idx as u32 , self . tcx . hir ( ) , param) ;
395+ let pair = Region :: late ( late_bound_idx as u32 , param) ;
399396 let r = late_region_as_bound_region ( self . tcx , & pair. 1 ) ;
400397 ( pair, r)
401398 } )
@@ -492,7 +489,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
492489 for param in generics. params {
493490 match param. kind {
494491 GenericParamKind :: Lifetime { .. } => {
495- let ( def_id, reg) = Region :: early ( self . tcx . hir ( ) , & param) ;
492+ let ( def_id, reg) = Region :: early ( & param) ;
496493 lifetimes. insert ( def_id, reg) ;
497494 }
498495 GenericParamKind :: Type { .. } | GenericParamKind :: Const { .. } => { }
@@ -523,9 +520,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
523520 . params
524521 . iter ( )
525522 . filter_map ( |param| match param. kind {
526- GenericParamKind :: Lifetime { .. } => {
527- Some ( Region :: early ( self . tcx . hir ( ) , param) )
528- }
523+ GenericParamKind :: Lifetime { .. } => Some ( Region :: early ( param) ) ,
529524 GenericParamKind :: Type { .. } | GenericParamKind :: Const { .. } => None ,
530525 } )
531526 . collect ( ) ;
@@ -573,7 +568,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
573568 . filter ( |param| matches ! ( param. kind, GenericParamKind :: Lifetime { .. } ) )
574569 . enumerate ( )
575570 . map ( |( late_bound_idx, param) | {
576- let pair = Region :: late ( late_bound_idx as u32 , self . tcx . hir ( ) , param) ;
571+ let pair = Region :: late ( late_bound_idx as u32 , param) ;
577572 let r = late_region_as_bound_region ( self . tcx , & pair. 1 ) ;
578573 ( pair, r)
579574 } )
@@ -731,9 +726,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
731726 . params
732727 . iter ( )
733728 . filter_map ( |param| match param. kind {
734- GenericParamKind :: Lifetime { .. } => {
735- Some ( Region :: early ( self . tcx . hir ( ) , param) )
736- }
729+ GenericParamKind :: Lifetime { .. } => Some ( Region :: early ( param) ) ,
737730 GenericParamKind :: Type { .. } | GenericParamKind :: Const { .. } => None ,
738731 } )
739732 . collect ( ) ;
@@ -779,9 +772,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
779772 . params
780773 . iter ( )
781774 . filter_map ( |param| match param. kind {
782- GenericParamKind :: Lifetime { .. } => {
783- Some ( Region :: early ( self . tcx . hir ( ) , param) )
784- }
775+ GenericParamKind :: Lifetime { .. } => Some ( Region :: early ( param) ) ,
785776 GenericParamKind :: Const { .. } | GenericParamKind :: Type { .. } => None ,
786777 } )
787778 . collect ( ) ;
@@ -886,7 +877,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
886877 } )
887878 . enumerate ( )
888879 . map ( |( late_bound_idx, param) | {
889- Region :: late ( late_bound_idx as u32 , this . tcx . hir ( ) , param)
880+ Region :: late ( late_bound_idx as u32 , param)
890881 } )
891882 . collect ( ) ;
892883 let binders: Vec < _ > =
@@ -999,8 +990,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
999990 . filter ( |param| matches ! ( param. kind, GenericParamKind :: Lifetime { .. } ) )
1000991 . enumerate ( )
1001992 . map ( |( late_bound_idx, param) | {
1002- let pair =
1003- Region :: late ( initial_bound_vars + late_bound_idx as u32 , self . tcx . hir ( ) , param) ;
993+ let pair = Region :: late ( initial_bound_vars + late_bound_idx as u32 , param) ;
1004994 let r = late_region_as_bound_region ( self . tcx , & pair. 1 ) ;
1005995 lifetimes. insert ( pair. 0 , pair. 1 ) ;
1006996 r
@@ -1131,9 +1121,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
11311121 if self . tcx . is_late_bound ( param. hir_id ) {
11321122 let late_bound_idx = named_late_bound_vars;
11331123 named_late_bound_vars += 1 ;
1134- Some ( Region :: late ( late_bound_idx, self . tcx . hir ( ) , param) )
1124+ Some ( Region :: late ( late_bound_idx, param) )
11351125 } else {
1136- Some ( Region :: early ( self . tcx . hir ( ) , param) )
1126+ Some ( Region :: early ( param) )
11371127 }
11381128 }
11391129 GenericParamKind :: Type { .. } | GenericParamKind :: Const { .. } => None ,
@@ -1149,7 +1139,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
11491139 } )
11501140 . enumerate ( )
11511141 . map ( |( late_bound_idx, param) | {
1152- let pair = Region :: late ( late_bound_idx as u32 , self . tcx . hir ( ) , param) ;
1142+ let pair = Region :: late ( late_bound_idx as u32 , param) ;
11531143 late_region_as_bound_region ( self . tcx , & pair. 1 )
11541144 } )
11551145 . collect ( ) ;
0 commit comments