Undo accidental test deletion in previous commit.
This commit is contained in:
parent
366c793306
commit
2e70fcdca8
1 changed files with 9 additions and 0 deletions
9
tests/compile-fail/static_memory_modification.rs
Normal file
9
tests/compile-fail/static_memory_modification.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue