Skip to content

Commit d7a9014

Browse files
committed
Inline and remove RegionConstraintStorage::remove_constraint_entry.
It has a single call site.
1 parent 6f75a39 commit d7a9014

File tree

1 file changed

+20
-24
lines changed
  • compiler/rustc_infer/src/infer/region_constraints

1 file changed

+20
-24
lines changed

compiler/rustc_infer/src/infer/region_constraints/mod.rs

+20-24
Original file line numberDiff line numberDiff line change
@@ -320,29 +320,6 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
320320
) -> RegionConstraintCollector<'a, 'tcx> {
321321
RegionConstraintCollector { storage: self, undo_log }
322322
}
323-
324-
fn rollback_undo_entry(&mut self, undo_entry: UndoLog<'tcx>) {
325-
match undo_entry {
326-
AddVar(vid) => {
327-
self.var_infos.pop().unwrap();
328-
assert_eq!(self.var_infos.len(), vid.index());
329-
}
330-
AddConstraint(index) => {
331-
self.data.constraints.pop().unwrap();
332-
assert_eq!(self.data.constraints.len(), index);
333-
}
334-
AddVerify(index) => {
335-
self.data.verifys.pop();
336-
assert_eq!(self.data.verifys.len(), index);
337-
}
338-
AddCombination(Glb, ref regions) => {
339-
self.glbs.remove(regions);
340-
}
341-
AddCombination(Lub, ref regions) => {
342-
self.lubs.remove(regions);
343-
}
344-
}
345-
}
346323
}
347324

348325
impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
@@ -793,6 +770,25 @@ impl<'tcx> RegionConstraintData<'tcx> {
793770

794771
impl<'tcx> Rollback<UndoLog<'tcx>> for RegionConstraintStorage<'tcx> {
795772
fn reverse(&mut self, undo: UndoLog<'tcx>) {
796-
self.rollback_undo_entry(undo)
773+
match undo {
774+
AddVar(vid) => {
775+
self.var_infos.pop().unwrap();
776+
assert_eq!(self.var_infos.len(), vid.index());
777+
}
778+
AddConstraint(index) => {
779+
self.data.constraints.pop().unwrap();
780+
assert_eq!(self.data.constraints.len(), index);
781+
}
782+
AddVerify(index) => {
783+
self.data.verifys.pop();
784+
assert_eq!(self.data.verifys.len(), index);
785+
}
786+
AddCombination(Glb, ref regions) => {
787+
self.glbs.remove(regions);
788+
}
789+
AddCombination(Lub, ref regions) => {
790+
self.lubs.remove(regions);
791+
}
792+
}
797793
}
798794
}

0 commit comments

Comments
 (0)