2018-10-19 16:07:40 +02:00
|
|
|
// Validation detects that we are casting & to &mut and so it changes why we fail
|
2018-10-24 17:17:44 +02:00
|
|
|
// compile-flags: -Zmiri-disable-validation
|
2018-10-19 16:07:40 +02:00
|
|
|
|
2016-09-13 20:17:52 -06:00
|
|
|
static X: usize = 5;
|
|
|
|
|
|
|
|
#[allow(mutable_transmutes)]
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2018-10-19 11:50:17 +02:00
|
|
|
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR tried to modify constant memory
|
2016-09-13 20:17:52 -06:00
|
|
|
assert_eq!(X, 6);
|
|
|
|
}
|
|
|
|
}
|