Auto merge of #3849 - RalfJung:tb-test, r=RalfJung
tree_borrows test: ensure we can actually read the variable
This commit is contained in:
commit
9f35309ef0
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user