about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-07-07 09:35:07 +0200
committerRalf Jung <post@ralfj.de>2024-07-07 09:35:09 +0200
commit6e754fee717abb1884f216123935532908c60613 (patch)
tree7c7ee2b5c1d39d1ba1a81c6da733f15e70279522
parent838b8d5898711fb3e8e8fe3fd51edbbd72f9e20d (diff)
downloadrust-6e754fee717abb1884f216123935532908c60613.tar.gz
rust-6e754fee717abb1884f216123935532908c60613.zip
Stacked Borrows: fix PartialEq for Stack
We have to compare unknown_bottom as well, it is semantically relevant!
-rw-r--r--src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs
index f65f49a75dd..774b36919fe 100644
--- a/src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs
+++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs
@@ -136,8 +136,16 @@ impl StackCache {
 
 impl PartialEq for Stack {
     fn eq(&self, other: &Self) -> bool {
-        // All the semantics of Stack are in self.borrows, everything else is caching
-        self.borrows == other.borrows
+        let Stack {
+            borrows,
+            unknown_bottom,
+            // The cache is ignored for comparison.
+            #[cfg(feature = "stack-cache")]
+                cache: _,
+            #[cfg(feature = "stack-cache")]
+                unique_range: _,
+        } = self;
+        *borrows == other.borrows && *unknown_bottom == other.unknown_bottom
     }
 }