Auto merge of #3849 - RalfJung:tb-test, r=RalfJung

tree_borrows test: ensure we can actually read the variable
This commit is contained in:
bors 2024-08-27 11:40:04 +00:00
commit 9f35309ef0

View File

@ -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);
}
}