rust/tests/compile-fail/null_pointer_deref_zst.rs

5 lines
173 B
Rust
Raw Normal View History

fn main() {
let x: () = unsafe { *std::ptr::null() }; //~ ERROR constant evaluation error: invalid use of NULL pointer
panic!("this should never print: {:?}", x);
}