rust/tests/compile-fail/stacked_borrows/static_memory_modification.rs

9 lines
192 B
Rust
Raw Normal View History

static X: usize = 5;
#[allow(mutable_transmutes)]
fn main() {
let _x = unsafe {
std::mem::transmute::<&usize, &mut usize>(&X) //~ ERROR mutable reference with frozen tag
};
}