@@ -45,7 +45,9 @@ use self::free_regions::RegionRelations;
4545use  self :: lexical_region_resolve:: LexicalRegionResolutions ; 
4646use  self :: outlives:: env:: OutlivesEnvironment ; 
4747use  self :: region_constraints:: { GenericKind ,  RegionConstraintData ,  VarInfos ,  VerifyBound } ; 
48- use  self :: region_constraints:: { RegionConstraintCollector ,  RegionConstraintStorage } ; 
48+ use  self :: region_constraints:: { 
49+     RegionConstraintCollector ,  RegionConstraintStorage ,  RegionSnapshot , 
50+ } ; 
4951use  self :: type_variable:: { TypeVariableOrigin ,  TypeVariableOriginKind } ; 
5052
5153pub  mod  at; 
@@ -265,7 +267,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
265267        self . const_unification_storage . with_log ( & mut  self . undo_log ) 
266268    } 
267269
268-     pub  fn  unwrap_region_constraints ( & mut  self )  -> RegionConstraintCollector < ' tcx ,  ' _ >  { 
270+     pub  fn  unwrap_region_constraints ( & mut  self )  -> RegionConstraintCollector < ' _ ,  ' tcx >  { 
269271        self . region_constraint_storage 
270272            . as_mut ( ) 
271273            . expect ( "region constraints already solved" ) 
@@ -706,6 +708,7 @@ impl<'tcx> InferOk<'tcx, ()> {
706708#[ must_use = "once you start a snapshot, you should always consume it" ]  
707709pub  struct  CombinedSnapshot < ' a ,  ' tcx >  { 
708710    undo_snapshot :  Snapshot < ' tcx > , 
711+     region_constraints_snapshot :  RegionSnapshot , 
709712    universe :  ty:: UniverseIndex , 
710713    was_in_snapshot :  bool , 
711714    _in_progress_tables :  Option < Ref < ' a ,  ty:: TypeckTables < ' tcx > > > , 
@@ -827,6 +830,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
827830
828831        CombinedSnapshot  { 
829832            undo_snapshot :  inner. undo_log . start_snapshot ( ) , 
833+             region_constraints_snapshot :  inner. unwrap_region_constraints ( ) . start_snapshot ( ) , 
830834            universe :  self . universe ( ) , 
831835            was_in_snapshot :  in_snapshot, 
832836            // Borrow tables "in progress" (i.e., during typeck) 
@@ -837,19 +841,31 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
837841
838842    fn  rollback_to ( & self ,  cause :  & str ,  snapshot :  CombinedSnapshot < ' a ,  ' tcx > )  { 
839843        debug ! ( "rollback_to(cause={})" ,  cause) ; 
840-         let  CombinedSnapshot  {  undo_snapshot,  universe,  was_in_snapshot,  _in_progress_tables }  =
841-             snapshot; 
844+         let  CombinedSnapshot  { 
845+             undo_snapshot, 
846+             region_constraints_snapshot, 
847+             universe, 
848+             was_in_snapshot, 
849+             _in_progress_tables, 
850+         }  = snapshot; 
842851
843852        self . in_snapshot . set ( was_in_snapshot) ; 
844853        self . universe . set ( universe) ; 
845854
846-         self . inner . borrow_mut ( ) . rollback_to ( undo_snapshot) ; 
855+         let  mut  inner = self . inner . borrow_mut ( ) ; 
856+         inner. rollback_to ( undo_snapshot) ; 
857+         inner. unwrap_region_constraints ( ) . rollback_to ( region_constraints_snapshot) ; 
847858    } 
848859
849860    fn  commit_from ( & self ,  snapshot :  CombinedSnapshot < ' a ,  ' tcx > )  { 
850861        debug ! ( "commit_from()" ) ; 
851-         let  CombinedSnapshot  {  undo_snapshot,  universe :  _,  was_in_snapshot,  _in_progress_tables }  =
852-             snapshot; 
862+         let  CombinedSnapshot  { 
863+             undo_snapshot, 
864+             region_constraints_snapshot :  _, 
865+             universe :  _, 
866+             was_in_snapshot, 
867+             _in_progress_tables, 
868+         }  = snapshot; 
853869
854870        self . in_snapshot . set ( was_in_snapshot) ; 
855871
0 commit comments