rust/tests/compile-fail/slice-too-big.rs
2019-08-31 08:41:55 +02:00

8 lines
232 B
Rust

use std::mem;
use std::usize;
fn main() { unsafe {
let ptr = Box::into_raw(Box::new(0u8));
let _x: &[u8] = mem::transmute((ptr, usize::MAX)); //~ ERROR: invalid slice: total size is bigger than largest supported object
} }