rust/tests/compile-fail/too-big-slice.rs
2022-03-26 11:08:11 -04:00

7 lines
224 B
Rust

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