We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a967611 + ef60c7c commit 298730eCopy full SHA for 298730e
src/libcore/cell.rs
@@ -618,7 +618,9 @@ impl<'b> Clone for BorrowRef<'b> {
618
// Since this Ref exists, we know the borrow flag
619
// is not set to WRITING.
620
let borrow = self.borrow.get();
621
- debug_assert!(borrow != WRITING && borrow != UNUSED);
+ debug_assert!(borrow != UNUSED);
622
+ // Prevent the borrow counter from overflowing.
623
+ assert!(borrow != WRITING);
624
self.borrow.set(borrow + 1);
625
BorrowRef { borrow: self.borrow }
626
}
0 commit comments