Skip to content

Commit

Permalink
Inline and remove RegionConstraintStorage::remove_constraint_entry.
Browse files Browse the repository at this point in the history
It has a single call site.
  • Loading branch information
nnethercote committed Oct 8, 2024
1 parent 2b57a78 commit 85507cf
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions compiler/rustc_infer/src/infer/region_constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,29 +320,6 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
) -> RegionConstraintCollector<'a, 'tcx> {
RegionConstraintCollector { storage: self, undo_log }
}

fn rollback_undo_entry(&mut self, undo_entry: UndoLog<'tcx>) {
match undo_entry {
AddVar(vid) => {
self.var_infos.pop().unwrap();
assert_eq!(self.var_infos.len(), vid.index());
}
AddConstraint(index) => {
self.data.constraints.pop().unwrap();
assert_eq!(self.data.constraints.len(), index);
}
AddVerify(index) => {
self.data.verifys.pop();
assert_eq!(self.data.verifys.len(), index);
}
AddCombination(Glb, ref regions) => {
self.glbs.remove(regions);
}
AddCombination(Lub, ref regions) => {
self.lubs.remove(regions);
}
}
}
}

impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
Expand Down Expand Up @@ -793,6 +770,25 @@ impl<'tcx> RegionConstraintData<'tcx> {

impl<'tcx> Rollback<UndoLog<'tcx>> for RegionConstraintStorage<'tcx> {
fn reverse(&mut self, undo: UndoLog<'tcx>) {
self.rollback_undo_entry(undo)
match undo {
AddVar(vid) => {
self.var_infos.pop().unwrap();
assert_eq!(self.var_infos.len(), vid.index());
}
AddConstraint(index) => {
self.data.constraints.pop().unwrap();
assert_eq!(self.data.constraints.len(), index);
}
AddVerify(index) => {
self.data.verifys.pop();
assert_eq!(self.data.verifys.len(), index);
}
AddCombination(Glb, ref regions) => {
self.glbs.remove(regions);
}
AddCombination(Lub, ref regions) => {
self.lubs.remove(regions);
}
}
}
}

0 comments on commit 85507cf

Please sign in to comment.