rust/tests/compile-fail/modifying_constants.rs
Ralf Jung b7c57fee61 Ignore tests
the bool thing will be fixed by the validation I have planned, and we already ignored another test around modifing constants.
2018-07-26 11:21:49 +02:00

10 lines
398 B
Rust

// ignore-test FIXME: we are not making these statics read-only any more?
fn main() {
let x = &1; // the `&1` is promoted to a constant, but it used to be that only the pointer is marked static, not the pointee
let y = unsafe { &mut *(x as *const i32 as *mut i32) };
*y = 42; //~ ERROR constant evaluation error
//~^ NOTE tried to modify constant memory
assert_eq!(*x, 42);
}