From a4c1079b50c7a66aac1e4bb03d4c652365774549 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Mon, 18 May 2020 19:15:04 -0700 Subject: [PATCH] borrow checker: add method to check that its empty --- crates/wiggle/src/borrow.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/wiggle/src/borrow.rs b/crates/wiggle/src/borrow.rs index 61851e8f57..992ecddeb5 100644 --- a/crates/wiggle/src/borrow.rs +++ b/crates/wiggle/src/borrow.rs @@ -25,6 +25,9 @@ impl BorrowChecker { pub fn is_borrowed(&self, r: Region) -> bool { self.bc.borrow().is_borrowed(r) } + pub fn is_empty(&self) -> bool { + self.bc.borrow().is_empty() + } } #[derive(Debug)] @@ -41,6 +44,10 @@ impl InnerBorrowChecker { } } + fn is_empty(&self) -> bool { + self.borrows.is_empty() + } + fn is_borrowed(&self, r: Region) -> bool { !self.borrows.values().all(|b| !b.overlaps(r)) }