rust/tests/compile-fail/slice-too-big.rs

7 lines
224 B
Rust
Raw Normal View History

2019-08-27 18:36:43 +02:00
use std::mem;
fn main() { unsafe {
let ptr = Box::into_raw(Box::new(0u8));
2020-03-04 23:16:24 +01:00
let _x: &[u8] = mem::transmute((ptr, usize::MAX)); //~ ERROR: invalid reference metadata: slice is bigger than largest supported object
2019-08-27 18:36:43 +02:00
} }