@@ -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 : ty :: UniverseIndex ,
51
+ skolemization_count : u32 ,
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 : ty :: UniverseIndex ,
236
+ skolemization_count : u32 ,
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 : ty :: UniverseIndex :: ROOT ,
280
+ skolemization_count : 0 ,
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. as_usize ( ) , 0 ) ;
332
+ assert_eq ! ( * skolemization_count, 0 ) ;
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
) ;
@@ -485,9 +485,9 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
485
485
assert ! ( self . in_snapshot( ) ) ;
486
486
assert ! ( self . undo_log[ snapshot. length] == OpenSnapshot ) ;
487
487
488
- let universe = self . skolemization_count . subuniverse ( ) ;
489
- self . skolemization_count = universe ;
490
- tcx. mk_region ( ReSkolemized ( universe , br) )
488
+ let sc = self . skolemization_count ;
489
+ self . skolemization_count = sc + 1 ;
490
+ tcx. mk_region ( ReSkolemized ( ty :: SkolemizedRegionVid { index : sc } , br) )
491
491
}
492
492
493
493
/// Removes all the edges to/from the skolemized regions that are
@@ -505,34 +505,34 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
505
505
assert ! ( self . in_snapshot( ) ) ;
506
506
assert ! ( self . undo_log[ snapshot. length] == OpenSnapshot ) ;
507
507
assert ! (
508
- self . skolemization_count. as_usize ( ) >= skols. len( ) ,
508
+ self . skolemization_count as usize >= skols. len( ) ,
509
509
"popping more skolemized variables than actually exist, \
510
510
sc now = {}, skols.len = {}",
511
- self . skolemization_count. as_usize ( ) ,
511
+ self . skolemization_count,
512
512
skols. len( )
513
513
) ;
514
514
515
- let last_to_pop = self . skolemization_count . subuniverse ( ) ;
516
- let first_to_pop = ty :: UniverseIndex :: from ( last_to_pop. as_u32 ( ) - ( skols. len ( ) as u32 ) ) ;
515
+ let last_to_pop = self . skolemization_count ;
516
+ let first_to_pop = last_to_pop - ( skols. len ( ) as u32 ) ;
517
517
518
518
assert ! (
519
519
first_to_pop >= snapshot. skolemization_count,
520
520
"popping more regions than snapshot contains, \
521
- sc now = {:? }, sc then = {:? }, skols.len = {}",
521
+ sc now = {}, sc then = {}, skols.len = {}",
522
522
self . skolemization_count,
523
523
snapshot. skolemization_count,
524
524
skols. len( )
525
525
) ;
526
526
debug_assert ! {
527
527
skols. iter( )
528
528
. all( |& k| match * k {
529
- ty:: ReSkolemized ( universe , _) =>
530
- universe >= first_to_pop &&
531
- universe < last_to_pop,
529
+ ty:: ReSkolemized ( index , _) =>
530
+ index . index >= first_to_pop &&
531
+ index . index < last_to_pop,
532
532
_ =>
533
533
false
534
534
} ) ,
535
- "invalid skolemization keys or keys out of range ({:? }..{:? }): {:?}" ,
535
+ "invalid skolemization keys or keys out of range ({}..{}): {:?}" ,
536
536
snapshot. skolemization_count,
537
537
self . skolemization_count,
538
538
skols
@@ -867,7 +867,7 @@ impl fmt::Debug for RegionSnapshot {
867
867
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
868
868
write ! (
869
869
f,
870
- "RegionSnapshot(length={},skolemization={:? })" ,
870
+ "RegionSnapshot(length={},skolemization={})" ,
871
871
self . length,
872
872
self . skolemization_count
873
873
)
0 commit comments