change redundant clear() to assertion

This commit is contained in:
lcnr 2023-05-23 19:00:47 +02:00
parent a0245bb3cb
commit 6b92d45342

View File

@ -138,11 +138,9 @@ impl<'tcx> InferCtxtInner<'tcx> {
} }
if self.undo_log.num_open_snapshots == 1 { if self.undo_log.num_open_snapshots == 1 {
// The root snapshot. It's safe to clear the undo log because // After the root snapshot the undo log should be empty.
// there's no snapshot further out that we might need to roll back
// to.
assert!(snapshot.undo_len == 0); assert!(snapshot.undo_len == 0);
self.undo_log.logs.clear(); assert!(self.undo_log.logs.is_empty());
} }
self.undo_log.num_open_snapshots -= 1; self.undo_log.num_open_snapshots -= 1;