2018-07-11 14:07:17 -05:00
|
|
|
// ignore-test FIXME: we are not making these statics read-only any more?
|
2016-09-13 21:17:52 -05:00
|
|
|
static X: usize = 5;
|
|
|
|
|
|
|
|
#[allow(mutable_transmutes)]
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2018-07-15 04:21:56 -05:00
|
|
|
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error
|
2018-05-09 12:24:25 -05:00
|
|
|
//~^ NOTE tried to modify constant memory
|
2016-09-13 21:17:52 -05:00
|
|
|
assert_eq!(X, 6);
|
|
|
|
}
|
|
|
|
}
|