Prevent the borrow counter from overflowing in Ref::clone
Fixes #33880.
This commit is contained in:
parent
bf9c60c9a6
commit
ef60c7cd49
@ -618,7 +618,9 @@ fn clone(&self) -> BorrowRef<'b> {
|
||||
// Since this Ref exists, we know the borrow flag
|
||||
// is not set to WRITING.
|
||||
let borrow = self.borrow.get();
|
||||
debug_assert!(borrow != WRITING && borrow != UNUSED);
|
||||
debug_assert!(borrow != UNUSED);
|
||||
// Prevent the borrow counter from overflowing.
|
||||
assert!(borrow != WRITING);
|
||||
self.borrow.set(borrow + 1);
|
||||
BorrowRef { borrow: self.borrow }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user