@@ -216,7 +216,7 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
216
216
217
217
lubs : RefCell < CombineMap < ' tcx > > ,
218
218
glbs : RefCell < CombineMap < ' tcx > > ,
219
- skolemization_count : Cell < u32 > ,
219
+ skolemization_count : Cell < ty :: UniverseIndex > ,
220
220
bound_count : Cell < u32 > ,
221
221
222
222
/// The undo log records actions that might later be undone.
@@ -240,7 +240,7 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
240
240
pub struct RegionSnapshot {
241
241
length : usize ,
242
242
region_snapshot : ut:: Snapshot < ut:: InPlace < ty:: RegionVid > > ,
243
- skolemization_count : u32 ,
243
+ skolemization_count : ty :: UniverseIndex ,
244
244
}
245
245
246
246
/// When working with skolemized regions, we often wish to find all of
@@ -362,7 +362,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
362
362
givens : RefCell :: new ( FxHashSet ( ) ) ,
363
363
lubs : RefCell :: new ( FxHashMap ( ) ) ,
364
364
glbs : RefCell :: new ( FxHashMap ( ) ) ,
365
- skolemization_count : Cell :: new ( 0 ) ,
365
+ skolemization_count : Cell :: new ( ty :: UniverseIndex :: ROOT ) ,
366
366
bound_count : Cell :: new ( 0 ) ,
367
367
undo_log : RefCell :: new ( Vec :: new ( ) ) ,
368
368
unification_table : RefCell :: new ( ut:: UnificationTable :: new ( ) ) ,
@@ -389,7 +389,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
389
389
assert ! ( self . undo_log. borrow( ) . len( ) > snapshot. length) ;
390
390
assert ! ( ( * self . undo_log. borrow( ) ) [ snapshot. length] == OpenSnapshot ) ;
391
391
assert ! ( self . skolemization_count. get( ) == snapshot. skolemization_count,
392
- "failed to pop skolemized regions: {} now vs {} at start" ,
392
+ "failed to pop skolemized regions: {:? } now vs {:? } at start" ,
393
393
self . skolemization_count. get( ) ,
394
394
snapshot. skolemization_count) ;
395
395
@@ -501,9 +501,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
501
501
assert ! ( self . in_snapshot( ) ) ;
502
502
assert ! ( self . undo_log. borrow( ) [ snapshot. length] == OpenSnapshot ) ;
503
503
504
- let sc = self . skolemization_count . get ( ) ;
505
- self . skolemization_count . set ( sc + 1 ) ;
506
- self . tcx . mk_region ( ReSkolemized ( ty :: SkolemizedRegionVid { index : sc } , br) )
504
+ let universe = self . skolemization_count . get ( ) . subuniverse ( ) ;
505
+ self . skolemization_count . set ( universe ) ;
506
+ self . tcx . mk_region ( ReSkolemized ( universe , br) )
507
507
}
508
508
509
509
/// Removes all the edges to/from the skolemized regions that are
@@ -517,31 +517,31 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
517
517
518
518
assert ! ( self . in_snapshot( ) ) ;
519
519
assert ! ( self . undo_log. borrow( ) [ snapshot. length] == OpenSnapshot ) ;
520
- assert ! ( self . skolemization_count. get( ) as usize >= skols. len( ) ,
520
+ assert ! ( self . skolemization_count. get( ) . as_usize ( ) >= skols. len( ) ,
521
521
"popping more skolemized variables than actually exist, \
522
522
sc now = {}, skols.len = {}",
523
- self . skolemization_count. get( ) ,
523
+ self . skolemization_count. get( ) . as_usize ( ) ,
524
524
skols. len( ) ) ;
525
525
526
- let last_to_pop = self . skolemization_count . get ( ) ;
527
- let first_to_pop = last_to_pop - ( skols. len ( ) as u32 ) ;
526
+ let last_to_pop = self . skolemization_count . get ( ) . subuniverse ( ) ;
527
+ let first_to_pop = ty :: UniverseIndex :: from ( last_to_pop. as_u32 ( ) - ( skols. len ( ) as u32 ) ) ;
528
528
529
529
assert ! ( first_to_pop >= snapshot. skolemization_count,
530
530
"popping more regions than snapshot contains, \
531
- sc now = {}, sc then = {}, skols.len = {}",
531
+ sc now = {:? }, sc then = {:? }, skols.len = {}",
532
532
self . skolemization_count. get( ) ,
533
533
snapshot. skolemization_count,
534
534
skols. len( ) ) ;
535
535
debug_assert ! {
536
536
skols. iter( )
537
537
. all( |& k| match * k {
538
- ty:: ReSkolemized ( index , _) =>
539
- index . index >= first_to_pop &&
540
- index . index < last_to_pop,
538
+ ty:: ReSkolemized ( universe , _) =>
539
+ universe >= first_to_pop &&
540
+ universe < last_to_pop,
541
541
_ =>
542
542
false
543
543
} ) ,
544
- "invalid skolemization keys or keys out of range ({}..{}): {:?}" ,
544
+ "invalid skolemization keys or keys out of range ({:? }..{:? }): {:?}" ,
545
545
snapshot. skolemization_count,
546
546
self . skolemization_count. get( ) ,
547
547
skols
@@ -1523,7 +1523,7 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
1523
1523
1524
1524
impl fmt:: Debug for RegionSnapshot {
1525
1525
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1526
- write ! ( f, "RegionSnapshot(length={},skolemization={})" ,
1526
+ write ! ( f, "RegionSnapshot(length={},skolemization={:? })" ,
1527
1527
self . length, self . skolemization_count)
1528
1528
}
1529
1529
}
0 commit comments