2018-10-19 09:07:40 -05:00
|
|
|
// Validation detects that we are casting & to &mut and so it changes why we fail
|
2018-10-24 10:17:44 -05:00
|
|
|
// compile-flags: -Zmiri-disable-validation
|
2018-10-19 09:07:40 -05:00
|
|
|
|
2016-09-19 05:10:18 -05:00
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
#[allow(mutable_transmutes)]
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let bs = b"this is a test";
|
2018-10-19 04:50:17 -05:00
|
|
|
transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR tried to modify constant memory
|
2016-09-19 05:10:18 -05:00
|
|
|
}
|
|
|
|
}
|