]> git.lizzy.rs Git - rust.git/blob - tests/fail/static_memory_modification1.rs
pointer tag tracking: on creation, log the offsets it is created for
[rust.git] / tests / fail / static_memory_modification1.rs
1 // Stacked Borrows detects that we are casting & to &mut and so it changes why we fail
2 // compile-flags: -Zmiri-disable-stacked-borrows
3
4 static X: usize = 5;
5
6 #[allow(mutable_transmutes)]
7 fn main() {
8     unsafe {
9         *std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR read-only
10         assert_eq!(X, 6);
11     }
12 }