@@ -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 ) ]
@@ -140,7 +139,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
140
139
/// empty region. The `expansion` phase will grow this larger.
141
140
fn construct_var_data ( & self , tcx : TyCtxt < ' tcx > ) -> LexicalRegionResolutions < ' tcx > {
142
141
LexicalRegionResolutions {
143
- error_region : tcx. lifetimes . re_static ,
144
142
values : IndexVec :: from_fn_n (
145
143
|vid| {
146
144
let vid_universe = self . var_infos [ vid] . universe ;
@@ -310,7 +308,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
310
308
311
309
// Check for the case where we know that `'b: 'static` -- in that case,
312
310
// `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 ( ) ;
314
312
if b_free_or_static && sub_free_regions ( tcx. lifetimes . re_static , b) {
315
313
return true ;
316
314
}
@@ -320,7 +318,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
320
318
// `lub` relationship defined below, since sometimes the "lub"
321
319
// is actually the `postdom_upper_bound` (see
322
320
// `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 ( ) ;
324
322
if a_free_or_static && b_free_or_static {
325
323
return sub_free_regions ( a, b) ;
326
324
}
@@ -864,10 +862,7 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
864
862
where
865
863
T : TypeFoldable < ' tcx > ,
866
864
{
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) )
871
866
}
872
867
873
868
fn value ( & self , rid : RegionVid ) -> & VarValue < ' tcx > {
@@ -878,12 +873,19 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
878
873
& mut self . values [ rid]
879
874
}
880
875
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,
885
887
} ;
886
- debug ! ( "resolve_var ({:?}) = {:?}" , rid , result) ;
888
+ debug ! ( "resolve_region ({:?}) = {:?}" , r , result) ;
887
889
result
888
890
}
889
891
}
0 commit comments