From 96444c11eee3a6d29d22056eee7e1d2ea73ebb19 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 31 May 2019 16:34:22 +0200 Subject: [PATCH] remove too expensive debug assertion --- src/stacked_borrows.rs | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 8c46f7e1b2e9..289fab99ad64 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -346,23 +346,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 @@ -418,11 +401,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(()) } }