mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
10 lines
226 B
Rust
10 lines
226 B
Rust
use std::mem::transmute;
|
|
|
|
#[allow(mutable_transmutes)]
|
|
fn main() {
|
|
unsafe {
|
|
let s = "this is a test";
|
|
transmute::<&[u8], &mut [u8]>(s.as_bytes())[4] = 42; //~ ERROR: tried to modify constant memory
|
|
}
|
|
}
|