borrow checker: add method to check that its empty
This commit is contained in:
@@ -25,6 +25,9 @@ impl BorrowChecker {
|
|||||||
pub fn is_borrowed(&self, r: Region) -> bool {
|
pub fn is_borrowed(&self, r: Region) -> bool {
|
||||||
self.bc.borrow().is_borrowed(r)
|
self.bc.borrow().is_borrowed(r)
|
||||||
}
|
}
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.bc.borrow().is_empty()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -41,6 +44,10 @@ impl InnerBorrowChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_empty(&self) -> bool {
|
||||||
|
self.borrows.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
fn is_borrowed(&self, r: Region) -> bool {
|
fn is_borrowed(&self, r: Region) -> bool {
|
||||||
!self.borrows.values().all(|b| !b.overlaps(r))
|
!self.borrows.values().all(|b| !b.overlaps(r))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user