tree_borrows test: ensure we can actually read the variable
This commit is contained in:
parent
2f13379dd1
commit
6f8fb3c15d
@ -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