mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
Rollup merge of #112757 - Danvil:patch-1, r=Mark-Simulacrum
Use BorrowFlag instead of explicit isize The integer type tracking borrow count has a typedef called `BorrowFlag`. This type should be used instead of explicit `isize`.
This commit is contained in:
@@ -1374,7 +1374,7 @@ fn clone(&self) -> Self {
|
||||
debug_assert!(is_reading(borrow));
|
||||
// Prevent the borrow counter from overflowing into
|
||||
// a writing borrow.
|
||||
assert!(borrow != isize::MAX);
|
||||
assert!(borrow != BorrowFlag::MAX);
|
||||
self.borrow.set(borrow + 1);
|
||||
BorrowRef { borrow: self.borrow }
|
||||
}
|
||||
@@ -1756,7 +1756,7 @@ fn clone(&self) -> BorrowRefMut<'b> {
|
||||
let borrow = self.borrow.get();
|
||||
debug_assert!(is_writing(borrow));
|
||||
// Prevent the borrow counter from underflowing.
|
||||
assert!(borrow != isize::MIN);
|
||||
assert!(borrow != BorrowFlag::MIN);
|
||||
self.borrow.set(borrow - 1);
|
||||
BorrowRefMut { borrow: self.borrow }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user