Skip to content

Commit 96444c1

Browse files
committed
remove too expensive debug assertion
1 parent ec629cc commit 96444c1

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
@@ -346,23 +346,6 @@ impl<'tcx> Stack {
346346
Ok(())
347347
}
348348

349-
/// `reborrow` helper function: test that the stack invariants are still maintained.
350-
fn test_invariants(&self) {
351-
let mut saw_shared_read_only = false;
352-
for item in self.borrows.iter() {
353-
match item.perm {
354-
Permission::SharedReadOnly => {
355-
saw_shared_read_only = true;
356-
}
357-
// Otherwise, if we saw one before, that's a bug.
358-
perm if saw_shared_read_only => {
359-
bug!("Found {:?} on top of a SharedReadOnly!", perm);
360-
}
361-
_ => {}
362-
}
363-
}
364-
}
365-
366349
/// Derived a new pointer from one with the given tag.
367350
/// `weak` controls whether this operation is weak or strong: weak granting does not act as
368351
/// an access, and they add the new item directly on top of the one it is derived
@@ -418,11 +401,6 @@ impl<'tcx> Stack {
418401
self.borrows.insert(new_idx, new);
419402
}
420403

421-
// Make sure that after all this, the stack's invariant is still maintained.
422-
if cfg!(debug_assertions) {
423-
self.test_invariants();
424-
}
425-
426404
Ok(())
427405
}
428406
}

0 commit comments

Comments
 (0)