about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-27 11:40:04 +0000
committerbors <bors@rust-lang.org>2024-08-27 11:40:04 +0000
commit9f35309ef08a2e38f0cb515c92386c898c7f83d9 (patch)
tree8c9b007f563e17c1e77395dc724020e1b4959721
parenteb7bf6e8f57d8a00451cb68d6b4acee35961f860 (diff)
parent6f8fb3c15d46c36e6d8103d5107a15b967ba5e17 (diff)
downloadrust-9f35309ef08a2e38f0cb515c92386c898c7f83d9.tar.gz
rust-9f35309ef08a2e38f0cb515c92386c898c7f83d9.zip
Auto merge of #3849 - RalfJung:tb-test, r=RalfJung
tree_borrows test: ensure we can actually read the variable
-rw-r--r--src/tools/miri/tests/pass/tree_borrows/sb_fails.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs b/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs
index 1bae30bde60..7da20e76229 100644
--- a/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs
+++ b/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs
@@ -67,10 +67,11 @@ mod static_memory_modification {
 
     #[allow(mutable_transmutes)]
     pub fn main() {
-        let _x = unsafe {
+        let x = unsafe {
             std::mem::transmute::<&usize, &mut usize>(&X) // In SB this mutable reborrow fails.
             // But in TB we are allowed to transmute as long as we don't write.
         };
+        assert_eq!(*&*x, 5);
     }
 }