mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-22 20:47:48 +00:00
10 lines
213 B
Rust
10 lines
213 B
Rust
static X: usize = 5;
|
|
|
|
#[allow(mutable_transmutes)]
|
|
fn main() {
|
|
unsafe {
|
|
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR: tried to modify constant memory
|
|
assert_eq!(X, 6);
|
|
}
|
|
}
|