Skip to content

Commit 964f6d9

Browse files
committed
Auto merge of rust-lang#3738 - RalfJung:stack-partial-eq, r=RalfJung
Stacked Borrows: fix PartialEq for Stack We have to compare unknown_bottom as well, it is semantically relevant! This could have merged two adjacent stacks that are not actually equal...
2 parents 838b8d5 + 6e754fe commit 964f6d9

File tree

1 file changed

+10
-2
lines changed
  • src/tools/miri/src/borrow_tracker/stacked_borrows

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,16 @@ impl StackCache {
136136

137137
impl PartialEq for Stack {
138138
fn eq(&self, other: &Self) -> bool {
139-
// All the semantics of Stack are in self.borrows, everything else is caching
140-
self.borrows == other.borrows
139+
let Stack {
140+
borrows,
141+
unknown_bottom,
142+
// The cache is ignored for comparison.
143+
#[cfg(feature = "stack-cache")]
144+
cache: _,
145+
#[cfg(feature = "stack-cache")]
146+
unique_range: _,
147+
} = self;
148+
*borrows == other.borrows && *unknown_bottom == other.unknown_bottom
141149
}
142150
}
143151

0 commit comments

Comments
 (0)