@@ -47,7 +47,6 @@ pub(crate) fn resolve<'tcx>(
47
47
#[ derive( Clone ) ]
48
48
pub struct LexicalRegionResolutions < ' tcx > {
49
49
pub ( crate ) values : IndexVec < RegionVid , VarValue < ' tcx > > ,
50
- pub ( crate ) error_region : ty:: Region < ' tcx > ,
51
50
}
52
51
53
52
#[ derive( Copy , Clone , Debug ) ]
@@ -144,7 +143,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
144
143
/// empty region. The `expansion` phase will grow this larger.
145
144
fn construct_var_data ( & self , tcx : TyCtxt < ' tcx > ) -> LexicalRegionResolutions < ' tcx > {
146
145
LexicalRegionResolutions {
147
- error_region : tcx. lifetimes . re_static ,
148
146
values : IndexVec :: from_fn_n (
149
147
|vid| {
150
148
let vid_universe = self . var_infos [ vid] . universe ;
@@ -314,7 +312,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
314
312
315
313
// Check for the case where we know that `'b: 'static` -- in that case,
316
314
// `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 ( ) ;
318
316
if b_free_or_static && sub_free_regions ( tcx. lifetimes . re_static , b) {
319
317
return true ;
320
318
}
@@ -324,7 +322,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
324
322
// `lub` relationship defined below, since sometimes the "lub"
325
323
// is actually the `postdom_upper_bound` (see
326
324
// `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 ( ) ;
328
326
if a_free_or_static && b_free_or_static {
329
327
return sub_free_regions ( a, b) ;
330
328
}
@@ -869,7 +867,7 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
869
867
T : TypeFoldable < ' tcx > ,
870
868
{
871
869
tcx. fold_regions ( value, |r, _db| match * r {
872
- ty:: ReVar ( rid ) => self . resolve_var ( rid ) ,
870
+ ty:: ReVar ( _ ) => self . resolve_region ( tcx , r ) ,
873
871
_ => r,
874
872
} )
875
873
}
@@ -882,12 +880,19 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
882
880
& mut self . values [ rid]
883
881
}
884
882
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,
889
894
} ;
890
- debug ! ( "resolve_var ({:?}) = {:?}" , rid , result) ;
895
+ debug ! ( "resolve_region ({:?}) = {:?}" , r , result) ;
891
896
result
892
897
}
893
898
}
0 commit comments