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);
|
|
|
|
}
|
|
|
|
}
|