tree_borrows test: ensure we can actually read the variable

This commit is contained in:
Ralf Jung 2024-08-27 13:38:29 +02:00
parent 2f13379dd1
commit 6f8fb3c15d

View File

@ -67,10 +67,11 @@ mod static_memory_modification {
#[allow(mutable_transmutes)] #[allow(mutable_transmutes)]
pub fn main() { pub fn main() {
let _x = unsafe { let x = unsafe {
std::mem::transmute::<&usize, &mut usize>(&X) // In SB this mutable reborrow fails. 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. // But in TB we are allowed to transmute as long as we don't write.
}; };
assert_eq!(*&*x, 5);
} }
} }