11//! See `README.md`.
22
33use self :: CombineMapType :: * ;
4- use self :: UndoLog :: * ;
54
6- use super :: { InferCtxtUndoLogs , MiscVariable , RegionVariableOrigin , Rollback , SubregionOrigin } ;
5+ use super :: { InferCtxtUndoLogs , MiscVariable , RegionVariableOrigin , SubregionOrigin } ;
76
87use rustc_data_structures:: fx:: FxIndexMap ;
98use rustc_data_structures:: intern:: Interned ;
@@ -264,21 +263,6 @@ pub(crate) struct TwoRegions<'tcx> {
264263 b : Region < ' tcx > ,
265264}
266265
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-
282266#[ derive( Copy , Clone , PartialEq ) ]
283267pub ( crate ) enum CombineMapType {
284268 Lub ,
@@ -314,29 +298,6 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
314298 ) -> RegionConstraintCollector < ' a , ' tcx > {
315299 RegionConstraintCollector { storage : self , undo_log }
316300 }
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- }
340301}
341302
342303impl < ' tcx > RegionConstraintCollector < ' _ , ' tcx > {
@@ -447,7 +408,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
447408
448409 let u_vid = self . unification_table_mut ( ) . new_key ( UnifiedRegion :: new ( None ) ) ;
449410 assert_eq ! ( vid, u_vid. vid) ;
450- self . undo_log . push ( AddVar ( vid) ) ;
451411 debug ! ( "created new region variable {:?} in {:?} with origin {:?}" , vid, universe, origin) ;
452412 vid
453413 }
@@ -465,10 +425,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
465425 fn add_constraint ( & mut self , constraint : Constraint < ' tcx > , origin : SubregionOrigin < ' tcx > ) {
466426 // cannot add constraints once regions are resolved
467427 debug ! ( "RegionConstraintCollector: add_constraint({:?})" , constraint) ;
468-
469- let index = self . storage . data . constraints . len ( ) ;
470428 self . storage . data . constraints . push ( ( constraint, origin) ) ;
471- self . undo_log . push ( AddConstraint ( index) ) ;
472429 }
473430
474431 fn add_verify ( & mut self , verify : Verify < ' tcx > ) {
@@ -482,9 +439,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
482439 return ;
483440 }
484441
485- let index = self . data . verifys . len ( ) ;
486442 self . data . verifys . push ( verify) ;
487- self . undo_log . push ( AddVerify ( index) ) ;
488443 }
489444
490445 pub ( super ) fn make_eqregion (
@@ -671,7 +626,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
671626 let c_universe = cmp:: max ( a_universe, b_universe) ;
672627 let c = self . new_region_var ( c_universe, MiscVariable ( origin. span ( ) ) ) ;
673628 self . combine_map ( t) . insert ( vars, c) ;
674- self . undo_log . push ( AddCombination ( t, vars) ) ;
675629 let new_r = ty:: Region :: new_var ( tcx, c) ;
676630 for old_r in [ a, b] {
677631 match t {
@@ -804,9 +758,3 @@ impl<'tcx> RegionConstraintData<'tcx> {
804758 constraints. is_empty ( ) && member_constraints. is_empty ( ) && verifys. is_empty ( )
805759 }
806760}
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