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";
|
2018-10-19 11:50:17 +02:00
|
|
|
transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR tried to modify constant memory
|
2016-09-19 04:10:18 -06:00
|
|
|
}
|
|
|
|
}
|