Skip to content

Commit 10cb5aa

Browse files
committed
borrow_tracker: update comments regarding protectors
1 parent a25ec22 commit 10cb5aa

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/tools/miri/src/borrow_tracker/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ pub struct GlobalStateInner {
9696
/// Next unused call ID (for protectors).
9797
next_call_id: CallId,
9898
/// All currently protected tags.
99-
/// An item is protected if its tag is in this set, *and* it has the "protected" bit set.
10099
/// We add tags to this when they are created with a protector in `reborrow`, and
101100
/// we remove tags from this when the call which is protecting them returns, in
102101
/// `GlobalStateInner::end_call`. See `Stack::item_invalidated` for more details.

src/tools/miri/src/borrow_tracker/stacked_borrows/item.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use crate::borrow_tracker::BorTag;
77
pub struct Item(u64);
88

99
// An Item contains 3 bitfields:
10-
// * Bits 0-61 store a BorTag
11-
// * Bits 61-63 store a Permission
12-
// * Bit 64 stores a flag which indicates if we have a protector
10+
// * Bits 0-61 store a BorTag.
11+
// * Bits 61-63 store a Permission.
12+
// * Bit 64 stores a flag which indicates if we might have a protector.
13+
// This is purely an optimization: if the bit is set, the tag *might* be
14+
// in `protected_tags`, but if the bit is not set then the tag is definitely
15+
// not in `protected_tags`.
1316
const TAG_MASK: u64 = u64::MAX >> 3;
1417
const PERM_MASK: u64 = 0x3 << 61;
1518
const PROTECTED_MASK: u64 = 0x1 << 63;

0 commit comments

Comments
 (0)