From 6f8fb3c15d46c36e6d8103d5107a15b967ba5e17 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 27 Aug 2024 13:38:29 +0200 Subject: [PATCH] tree_borrows test: ensure we can actually read the variable --- src/tools/miri/tests/pass/tree_borrows/sb_fails.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } }