Skip to content

Commit 09daf11

Browse files
authored
remove too expensive debug assertion (#755)
remove too expensive debug assertion
2 parents 0c4d688 + 03b74c1 commit 09daf11

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

src/stacked_borrows.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -356,23 +356,6 @@ impl<'tcx> Stack {
356356
Ok(())
357357
}
358358

359-
/// `reborrow` helper function: test that the stack invariants are still maintained.
360-
fn test_invariants(&self) {
361-
let mut saw_shared_read_only = false;
362-
for item in self.borrows.iter() {
363-
match item.perm {
364-
Permission::SharedReadOnly => {
365-
saw_shared_read_only = true;
366-
}
367-
// Otherwise, if we saw one before, that's a bug.
368-
perm if saw_shared_read_only => {
369-
bug!("Found {:?} on top of a SharedReadOnly!", perm);
370-
}
371-
_ => {}
372-
}
373-
}
374-
}
375-
376359
/// Derived a new pointer from one with the given tag.
377360
/// `weak` controls whether this operation is weak or strong: weak granting does not act as
378361
/// an access, and they add the new item directly on top of the one it is derived
@@ -428,11 +411,6 @@ impl<'tcx> Stack {
428411
self.borrows.insert(new_idx, new);
429412
}
430413

431-
// Make sure that after all this, the stack's invariant is still maintained.
432-
if cfg!(debug_assertions) {
433-
self.test_invariants();
434-
}
435-
436414
Ok(())
437415
}
438416
}

0 commit comments

Comments
 (0)