@@ -48,7 +48,7 @@ pub struct RegionConstraintCollector<'tcx> {
48
48
glbs : CombineMap < ' tcx > ,
49
49
50
50
/// Number of skolemized variables currently active.
51
- skolemization_count : u32 ,
51
+ skolemization_count : ty :: UniverseIndex ,
52
52
53
53
/// Global counter used during the GLB algorithm to create unique
54
54
/// names for fresh bound regions
@@ -233,7 +233,7 @@ type CombineMap<'tcx> = FxHashMap<TwoRegions<'tcx>, RegionVid>;
233
233
pub struct RegionSnapshot {
234
234
length : usize ,
235
235
region_snapshot : ut:: Snapshot < ut:: InPlace < ty:: RegionVid > > ,
236
- skolemization_count : u32 ,
236
+ skolemization_count : ty :: UniverseIndex ,
237
237
}
238
238
239
239
/// When working with skolemized regions, we often wish to find all of
@@ -277,7 +277,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
277
277
data : RegionConstraintData :: default ( ) ,
278
278
lubs : FxHashMap ( ) ,
279
279
glbs : FxHashMap ( ) ,
280
- skolemization_count : 0 ,
280
+ skolemization_count : ty :: UniverseIndex :: ROOT ,
281
281
bound_count : 0 ,
282
282
undo_log : Vec :: new ( ) ,
283
283
unification_table : ut:: UnificationTable :: new ( ) ,
@@ -329,7 +329,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
329
329
unification_table,
330
330
} = self ;
331
331
332
- assert_eq ! ( * skolemization_count, 0 ) ;
332
+ assert_eq ! ( * skolemization_count, ty :: UniverseIndex :: ROOT ) ;
333
333
334
334
// Clear the tables of (lubs, glbs), so that we will create
335
335
// fresh regions if we do a LUB operation. As it happens,
@@ -375,7 +375,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
375
375
assert ! ( self . undo_log[ snapshot. length] == OpenSnapshot ) ;
376
376
assert ! (
377
377
self . skolemization_count == snapshot. skolemization_count,
378
- "failed to pop skolemized regions: {} now vs {} at start" ,
378
+ "failed to pop skolemized regions: {:? } now vs {:? } at start" ,
379
379
self . skolemization_count,
380
380
snapshot. skolemization_count
381
381
) ;
@@ -483,9 +483,9 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
483
483
assert ! ( self . in_snapshot( ) ) ;
484
484
assert ! ( self . undo_log[ snapshot. length] == OpenSnapshot ) ;
485
485
486
- let sc = self . skolemization_count ;
487
- self . skolemization_count = sc + 1 ;
488
- tcx. mk_region ( ReSkolemized ( ty :: SkolemizedRegionVid { index : sc } , br) )
486
+ let universe = self . skolemization_count . subuniverse ( ) ;
487
+ self . skolemization_count = universe ;
488
+ tcx. mk_region ( ReSkolemized ( universe , br) )
489
489
}
490
490
491
491
/// Removes all the edges to/from the skolemized regions that are
@@ -503,34 +503,34 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
503
503
assert ! ( self . in_snapshot( ) ) ;
504
504
assert ! ( self . undo_log[ snapshot. length] == OpenSnapshot ) ;
505
505
assert ! (
506
- self . skolemization_count as usize >= skols. len( ) ,
506
+ self . skolemization_count. as_usize ( ) >= skols. len( ) ,
507
507
"popping more skolemized variables than actually exist, \
508
- sc now = {}, skols.len = {}",
508
+ sc now = {:? }, skols.len = {:? }",
509
509
self . skolemization_count,
510
510
skols. len( )
511
511
) ;
512
512
513
- let last_to_pop = self . skolemization_count ;
514
- let first_to_pop = last_to_pop - ( skols. len ( ) as u32 ) ;
513
+ let last_to_pop = self . skolemization_count . subuniverse ( ) ;
514
+ let first_to_pop = ty :: UniverseIndex :: from ( last_to_pop. as_u32 ( ) - skols. len ( ) as u32 ) ;
515
515
516
516
assert ! (
517
517
first_to_pop >= snapshot. skolemization_count,
518
518
"popping more regions than snapshot contains, \
519
- sc now = {}, sc then = {}, skols.len = {}",
519
+ sc now = {:? }, sc then = {:? }, skols.len = {:? }",
520
520
self . skolemization_count,
521
521
snapshot. skolemization_count,
522
522
skols. len( )
523
523
) ;
524
524
debug_assert ! {
525
525
skols. iter( )
526
526
. all( |& k| match * k {
527
- ty:: ReSkolemized ( index , _) =>
528
- index . index >= first_to_pop &&
529
- index . index < last_to_pop,
527
+ ty:: ReSkolemized ( universe , _) =>
528
+ universe >= first_to_pop &&
529
+ universe < last_to_pop,
530
530
_ =>
531
531
false
532
532
} ) ,
533
- "invalid skolemization keys or keys out of range ({}..{}): {:?}" ,
533
+ "invalid skolemization keys or keys out of range ({:? }..{:? }): {:?}" ,
534
534
snapshot. skolemization_count,
535
535
self . skolemization_count,
536
536
skols
@@ -865,7 +865,7 @@ impl fmt::Debug for RegionSnapshot {
865
865
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
866
866
write ! (
867
867
f,
868
- "RegionSnapshot(length={},skolemization={})" ,
868
+ "RegionSnapshot(length={},skolemization={:? })" ,
869
869
self . length,
870
870
self . skolemization_count
871
871
)
0 commit comments