@@ -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 ) ]
@@ -144,7 +143,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
144143 /// empty region. The `expansion` phase will grow this larger.
145144 fn construct_var_data ( & self , tcx : TyCtxt < ' tcx > ) -> LexicalRegionResolutions < ' tcx > {
146145 LexicalRegionResolutions {
147- error_region : tcx. lifetimes . re_static ,
148146 values : IndexVec :: from_fn_n (
149147 |vid| {
150148 let vid_universe = self . var_infos [ vid] . universe ;
@@ -314,7 +312,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
314312
315313 // Check for the case where we know that `'b: 'static` -- in that case,
316314 // `a <= b` for all `a`.
317- let b_free_or_static = self . region_rels . free_regions . is_free_or_static ( b ) ;
315+ let b_free_or_static = b . is_free_or_static ( ) ;
318316 if b_free_or_static && sub_free_regions ( tcx. lifetimes . re_static , b) {
319317 return true ;
320318 }
@@ -324,7 +322,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
324322 // `lub` relationship defined below, since sometimes the "lub"
325323 // is actually the `postdom_upper_bound` (see
326324 // `TransitiveRelation` for more details).
327- let a_free_or_static = self . region_rels . free_regions . is_free_or_static ( a ) ;
325+ let a_free_or_static = a . is_free_or_static ( ) ;
328326 if a_free_or_static && b_free_or_static {
329327 return sub_free_regions ( a, b) ;
330328 }
@@ -869,7 +867,7 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
869867 T : TypeFoldable < ' tcx > ,
870868 {
871869 tcx. fold_regions ( value, |r, _db| match * r {
872- ty:: ReVar ( rid ) => self . resolve_var ( rid ) ,
870+ ty:: ReVar ( _ ) => self . resolve_region ( tcx , r ) ,
873871 _ => r,
874872 } )
875873 }
@@ -882,12 +880,19 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
882880 & mut self . values [ rid]
883881 }
884882
885- pub fn resolve_var ( & self , rid : RegionVid ) -> ty:: Region < ' tcx > {
886- let result = match self . values [ rid] {
887- VarValue :: Value ( r) => r,
888- VarValue :: ErrorValue => self . error_region ,
883+ pub ( crate ) fn resolve_region (
884+ & self ,
885+ tcx : TyCtxt < ' tcx > ,
886+ r : ty:: Region < ' tcx > ,
887+ ) -> ty:: Region < ' tcx > {
888+ let result = match * r {
889+ ty:: ReVar ( rid) => match self . values [ rid] {
890+ VarValue :: Value ( r) => r,
891+ VarValue :: ErrorValue => tcx. lifetimes . re_static ,
892+ } ,
893+ _ => r,
889894 } ;
890- debug ! ( "resolve_var ({:?}) = {:?}" , rid , result) ;
895+ debug ! ( "resolve_region ({:?}) = {:?}" , r , result) ;
891896 result
892897 }
893898}
0 commit comments