@@ -47,7 +47,6 @@ pub(crate) fn resolve<'tcx>(
4747#[ derive( Clone ) ]
4848pub struct LexicalRegionResolutions < ' tcx > {
4949 pub ( crate ) values : IndexVec < RegionVid , VarValue < ' tcx > > ,
50- pub ( crate ) error_region : ty:: Region < ' tcx > ,
5150}
5251
5352#[ derive( Copy , Clone , Debug ) ]
@@ -140,7 +139,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
140139 /// empty region. The `expansion` phase will grow this larger.
141140 fn construct_var_data ( & self , tcx : TyCtxt < ' tcx > ) -> LexicalRegionResolutions < ' tcx > {
142141 LexicalRegionResolutions {
143- error_region : tcx. lifetimes . re_static ,
144142 values : IndexVec :: from_fn_n (
145143 |vid| {
146144 let vid_universe = self . var_infos [ vid] . universe ;
@@ -310,7 +308,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
310308
311309 // Check for the case where we know that `'b: 'static` -- in that case,
312310 // `a <= b` for all `a`.
313- let b_free_or_static = self . region_rels . free_regions . is_free_or_static ( b ) ;
311+ let b_free_or_static = b . is_free_or_static ( ) ;
314312 if b_free_or_static && sub_free_regions ( tcx. lifetimes . re_static , b) {
315313 return true ;
316314 }
@@ -320,7 +318,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
320318 // `lub` relationship defined below, since sometimes the "lub"
321319 // is actually the `postdom_upper_bound` (see
322320 // `TransitiveRelation` for more details).
323- let a_free_or_static = self . region_rels . free_regions . is_free_or_static ( a ) ;
321+ let a_free_or_static = a . is_free_or_static ( ) ;
324322 if a_free_or_static && b_free_or_static {
325323 return sub_free_regions ( a, b) ;
326324 }
@@ -864,10 +862,7 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
864862 where
865863 T : TypeFoldable < ' tcx > ,
866864 {
867- tcx. fold_regions ( value, |r, _db| match * r {
868- ty:: ReVar ( rid) => self . resolve_var ( rid) ,
869- _ => r,
870- } )
865+ tcx. fold_regions ( value, |r, _db| self . resolve_region ( tcx, r) )
871866 }
872867
873868 fn value ( & self , rid : RegionVid ) -> & VarValue < ' tcx > {
@@ -878,12 +873,19 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
878873 & mut self . values [ rid]
879874 }
880875
881- pub fn resolve_var ( & self , rid : RegionVid ) -> ty:: Region < ' tcx > {
882- let result = match self . values [ rid] {
883- VarValue :: Value ( r) => r,
884- VarValue :: ErrorValue => self . error_region ,
876+ pub ( crate ) fn resolve_region (
877+ & self ,
878+ tcx : TyCtxt < ' tcx > ,
879+ r : ty:: Region < ' tcx > ,
880+ ) -> ty:: Region < ' tcx > {
881+ let result = match * r {
882+ ty:: ReVar ( rid) => match self . values [ rid] {
883+ VarValue :: Value ( r) => r,
884+ VarValue :: ErrorValue => tcx. lifetimes . re_static ,
885+ } ,
886+ _ => r,
885887 } ;
886- debug ! ( "resolve_var ({:?}) = {:?}" , rid , result) ;
888+ debug ! ( "resolve_region ({:?}) = {:?}" , r , result) ;
887889 result
888890 }
889891}
0 commit comments