1
1
//! See `README.md`.
2
2
3
3
use self :: CombineMapType :: * ;
4
- use self :: UndoLog :: * ;
5
4
6
- use super :: { InferCtxtUndoLogs , MiscVariable , RegionVariableOrigin , Rollback , SubregionOrigin } ;
5
+ use super :: { InferCtxtUndoLogs , MiscVariable , RegionVariableOrigin , SubregionOrigin } ;
7
6
8
7
use rustc_data_structures:: fx:: FxIndexMap ;
9
8
use rustc_data_structures:: intern:: Interned ;
@@ -264,21 +263,6 @@ pub(crate) struct TwoRegions<'tcx> {
264
263
b : Region < ' tcx > ,
265
264
}
266
265
267
- #[ derive( Copy , Clone , PartialEq ) ]
268
- pub ( crate ) enum UndoLog < ' tcx > {
269
- /// We added `RegionVid`.
270
- AddVar ( RegionVid ) ,
271
-
272
- /// We added the given `constraint`.
273
- AddConstraint ( usize ) ,
274
-
275
- /// We added the given `verify`.
276
- AddVerify ( usize ) ,
277
-
278
- /// We added a GLB/LUB "combination variable".
279
- AddCombination ( CombineMapType , TwoRegions < ' tcx > ) ,
280
- }
281
-
282
266
#[ derive( Copy , Clone , PartialEq ) ]
283
267
pub ( crate ) enum CombineMapType {
284
268
Lub ,
@@ -314,29 +298,6 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
314
298
) -> RegionConstraintCollector < ' a , ' tcx > {
315
299
RegionConstraintCollector { storage : self , undo_log }
316
300
}
317
-
318
- fn rollback_undo_entry ( & mut self , undo_entry : UndoLog < ' tcx > ) {
319
- match undo_entry {
320
- AddVar ( vid) => {
321
- self . var_infos . pop ( ) . unwrap ( ) ;
322
- assert_eq ! ( self . var_infos. len( ) , vid. index( ) ) ;
323
- }
324
- AddConstraint ( index) => {
325
- self . data . constraints . pop ( ) . unwrap ( ) ;
326
- assert_eq ! ( self . data. constraints. len( ) , index) ;
327
- }
328
- AddVerify ( index) => {
329
- self . data . verifys . pop ( ) ;
330
- assert_eq ! ( self . data. verifys. len( ) , index) ;
331
- }
332
- AddCombination ( Glb , ref regions) => {
333
- self . glbs . remove ( regions) ;
334
- }
335
- AddCombination ( Lub , ref regions) => {
336
- self . lubs . remove ( regions) ;
337
- }
338
- }
339
- }
340
301
}
341
302
342
303
impl < ' tcx > RegionConstraintCollector < ' _ , ' tcx > {
@@ -447,7 +408,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
447
408
448
409
let u_vid = self . unification_table_mut ( ) . new_key ( UnifiedRegion :: new ( None ) ) ;
449
410
assert_eq ! ( vid, u_vid. vid) ;
450
- self . undo_log . push ( AddVar ( vid) ) ;
451
411
debug ! ( "created new region variable {:?} in {:?} with origin {:?}" , vid, universe, origin) ;
452
412
vid
453
413
}
@@ -465,10 +425,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
465
425
fn add_constraint ( & mut self , constraint : Constraint < ' tcx > , origin : SubregionOrigin < ' tcx > ) {
466
426
// cannot add constraints once regions are resolved
467
427
debug ! ( "RegionConstraintCollector: add_constraint({:?})" , constraint) ;
468
-
469
- let index = self . storage . data . constraints . len ( ) ;
470
428
self . storage . data . constraints . push ( ( constraint, origin) ) ;
471
- self . undo_log . push ( AddConstraint ( index) ) ;
472
429
}
473
430
474
431
fn add_verify ( & mut self , verify : Verify < ' tcx > ) {
@@ -482,9 +439,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
482
439
return ;
483
440
}
484
441
485
- let index = self . data . verifys . len ( ) ;
486
442
self . data . verifys . push ( verify) ;
487
- self . undo_log . push ( AddVerify ( index) ) ;
488
443
}
489
444
490
445
pub ( super ) fn make_eqregion (
@@ -671,7 +626,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
671
626
let c_universe = cmp:: max ( a_universe, b_universe) ;
672
627
let c = self . new_region_var ( c_universe, MiscVariable ( origin. span ( ) ) ) ;
673
628
self . combine_map ( t) . insert ( vars, c) ;
674
- self . undo_log . push ( AddCombination ( t, vars) ) ;
675
629
let new_r = ty:: Region :: new_var ( tcx, c) ;
676
630
for old_r in [ a, b] {
677
631
match t {
@@ -804,9 +758,3 @@ impl<'tcx> RegionConstraintData<'tcx> {
804
758
constraints. is_empty ( ) && member_constraints. is_empty ( ) && verifys. is_empty ( )
805
759
}
806
760
}
807
-
808
- impl < ' tcx > Rollback < UndoLog < ' tcx > > for RegionConstraintStorage < ' tcx > {
809
- fn reverse ( & mut self , undo : UndoLog < ' tcx > ) {
810
- self . rollback_undo_entry ( undo)
811
- }
812
- }
0 commit comments