Skip to content

Commit 9f35309

Browse files
committed
Auto merge of #3849 - RalfJung:tb-test, r=RalfJung
tree_borrows test: ensure we can actually read the variable
2 parents eb7bf6e + 6f8fb3c commit 9f35309

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/miri/tests/pass/tree_borrows/sb_fails.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ mod static_memory_modification {
6767

6868
#[allow(mutable_transmutes)]
6969
pub fn main() {
70-
let _x = unsafe {
70+
let x = unsafe {
7171
std::mem::transmute::<&usize, &mut usize>(&X) // In SB this mutable reborrow fails.
7272
// But in TB we are allowed to transmute as long as we don't write.
7373
};
74+
assert_eq!(*&*x, 5);
7475
}
7576
}
7677

0 commit comments

Comments
 (0)