@@ -191,7 +191,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
191
191
/// part of the root universe. So this would only get incremented
192
192
/// when we enter into a higher-ranked (`for<..>`) type or trait
193
193
/// bound.
194
- pub universe : ty:: UniverseIndex ,
194
+ universe : Cell < ty:: UniverseIndex > ,
195
195
}
196
196
197
197
/// A map returned by `skolemize_late_bound_regions()` indicating the skolemized
@@ -464,7 +464,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
464
464
err_count_on_creation : tcx. sess . err_count ( ) ,
465
465
in_snapshot : Cell :: new ( false ) ,
466
466
region_obligations : RefCell :: new ( vec ! [ ] ) ,
467
- universe : ty:: UniverseIndex :: ROOT ,
467
+ universe : Cell :: new ( ty:: UniverseIndex :: ROOT ) ,
468
468
} ) )
469
469
}
470
470
}
@@ -850,7 +850,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
850
850
pub fn next_ty_var_id ( & self , diverging : bool , origin : TypeVariableOrigin ) -> TyVid {
851
851
self . type_variables
852
852
. borrow_mut ( )
853
- . new_var ( self . universe , diverging, origin)
853
+ . new_var ( self . universe ( ) , diverging, origin)
854
854
}
855
855
856
856
pub fn next_ty_var ( & self , origin : TypeVariableOrigin ) -> Ty < ' tcx > {
@@ -882,7 +882,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
882
882
pub fn next_region_var ( & self , origin : RegionVariableOrigin )
883
883
-> ty:: Region < ' tcx > {
884
884
let region_var = self . borrow_region_constraints ( )
885
- . new_region_var ( self . universe , origin) ;
885
+ . new_region_var ( self . universe ( ) , origin) ;
886
886
self . tcx . mk_region ( ty:: ReVar ( region_var) )
887
887
}
888
888
@@ -920,7 +920,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
920
920
-> Ty < ' tcx > {
921
921
let ty_var_id = self . type_variables
922
922
. borrow_mut ( )
923
- . new_var ( self . universe ,
923
+ . new_var ( self . universe ( ) ,
924
924
false ,
925
925
TypeVariableOrigin :: TypeParameterDefinition ( span, def. name ) ) ;
926
926
@@ -1335,6 +1335,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1335
1335
self . evaluation_cache . clear ( ) ;
1336
1336
self . projection_cache . borrow_mut ( ) . clear ( ) ;
1337
1337
}
1338
+
1339
+ fn universe ( & self ) -> ty:: UniverseIndex {
1340
+ self . universe . get ( )
1341
+ }
1338
1342
}
1339
1343
1340
1344
impl < ' a , ' gcx , ' tcx > TypeTrace < ' tcx > {
0 commit comments