2020-02-24 16:22:02 +01:00
|
|
|
// Stacked Borrows detects that we are casting & to &mut and so it changes why we fail
|
|
|
|
// compile-flags: -Zmiri-disable-stacked-borrows
|
2018-10-19 16:07:40 +02:00
|
|
|
|
2016-09-19 04:10:18 -06:00
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
#[allow(mutable_transmutes)]
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let bs = b"this is a test";
|
2020-03-08 23:34:54 +01:00
|
|
|
transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR read-only
|
2016-09-19 04:10:18 -06:00
|
|
|
}
|
|
|
|
}
|