remove too expensive debug assertion (#755)

remove too expensive debug assertion
This commit is contained in:
Ralf Jung 2019-06-03 12:14:52 +02:00 committed by GitHub
commit 09daf11349
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -356,23 +356,6 @@ impl<'tcx> Stack {
Ok(())
}
/// `reborrow` helper function: test that the stack invariants are still maintained.
fn test_invariants(&self) {
let mut saw_shared_read_only = false;
for item in self.borrows.iter() {
match item.perm {
Permission::SharedReadOnly => {
saw_shared_read_only = true;
}
// Otherwise, if we saw one before, that's a bug.
perm if saw_shared_read_only => {
bug!("Found {:?} on top of a SharedReadOnly!", perm);
}
_ => {}
}
}
}
/// Derived a new pointer from one with the given tag.
/// `weak` controls whether this operation is weak or strong: weak granting does not act as
/// an access, and they add the new item directly on top of the one it is derived
@ -428,11 +411,6 @@ impl<'tcx> Stack {
self.borrows.insert(new_idx, new);
}
// Make sure that after all this, the stack's invariant is still maintained.
if cfg!(debug_assertions) {
self.test_invariants();
}
Ok(())
}
}