@@ -193,7 +193,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
193
193
/// part of the root universe. So this would only get incremented
194
194
/// when we enter into a higher-ranked (`for<..>`) type or trait
195
195
/// bound.
196
- pub universe : ty:: UniverseIndex ,
196
+ universe : Cell < ty:: UniverseIndex > ,
197
197
}
198
198
199
199
/// A map returned by `skolemize_late_bound_regions()` indicating the skolemized
@@ -466,7 +466,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
466
466
err_count_on_creation : tcx. sess . err_count ( ) ,
467
467
in_snapshot : Cell :: new ( false ) ,
468
468
region_obligations : RefCell :: new ( vec ! [ ] ) ,
469
- universe : ty:: UniverseIndex :: ROOT ,
469
+ universe : Cell :: new ( ty:: UniverseIndex :: ROOT ) ,
470
470
} ) )
471
471
}
472
472
}
@@ -853,7 +853,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
853
853
pub fn next_ty_var_id ( & self , diverging : bool , origin : TypeVariableOrigin ) -> TyVid {
854
854
self . type_variables
855
855
. borrow_mut ( )
856
- . new_var ( self . universe , diverging, origin)
856
+ . new_var ( self . universe ( ) , diverging, origin)
857
857
}
858
858
859
859
pub fn next_ty_var ( & self , origin : TypeVariableOrigin ) -> Ty < ' tcx > {
@@ -885,7 +885,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
885
885
pub fn next_region_var ( & self , origin : RegionVariableOrigin )
886
886
-> ty:: Region < ' tcx > {
887
887
let region_var = self . borrow_region_constraints ( )
888
- . new_region_var ( self . universe , origin) ;
888
+ . new_region_var ( self . universe ( ) , origin) ;
889
889
self . tcx . mk_region ( ty:: ReVar ( region_var) )
890
890
}
891
891
@@ -923,7 +923,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
923
923
-> Ty < ' tcx > {
924
924
let ty_var_id = self . type_variables
925
925
. borrow_mut ( )
926
- . new_var ( self . universe ,
926
+ . new_var ( self . universe ( ) ,
927
927
false ,
928
928
TypeVariableOrigin :: TypeParameterDefinition ( span, def. name ) ) ;
929
929
@@ -1371,6 +1371,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1371
1371
self . evaluation_cache . clear ( ) ;
1372
1372
self . projection_cache . borrow_mut ( ) . clear ( ) ;
1373
1373
}
1374
+
1375
+ fn universe ( & self ) -> ty:: UniverseIndex {
1376
+ self . universe . get ( )
1377
+ }
1374
1378
}
1375
1379
1376
1380
impl < ' a , ' gcx , ' tcx > TypeTrace < ' tcx > {
0 commit comments