Skip to content

Commit 7d072fa

Browse files
authored
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`.
2 parents af348a8 + 09707ee commit 7d072fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ impl Clone for BorrowRef<'_> {
13741374
debug_assert!(is_reading(borrow));
13751375
// Prevent the borrow counter from overflowing into
13761376
// a writing borrow.
1377-
assert!(borrow != isize::MAX);
1377+
assert!(borrow != BorrowFlag::MAX);
13781378
self.borrow.set(borrow + 1);
13791379
BorrowRef { borrow: self.borrow }
13801380
}
@@ -1756,7 +1756,7 @@ impl<'b> BorrowRefMut<'b> {
17561756
let borrow = self.borrow.get();
17571757
debug_assert!(is_writing(borrow));
17581758
// Prevent the borrow counter from underflowing.
1759-
assert!(borrow != isize::MIN);
1759+
assert!(borrow != BorrowFlag::MIN);
17601760
self.borrow.set(borrow - 1);
17611761
BorrowRefMut { borrow: self.borrow }
17621762
}

0 commit comments

Comments
 (0)