rust/tests/compile-fail/null_pointer_deref_zst.rs

5 lines
146 B
Rust
Raw Normal View History

fn main() {
2019-04-21 06:18:05 -05:00
let x: () = unsafe { *std::ptr::null() }; //~ ERROR invalid use of NULL pointer
panic!("this should never print: {:?}", x);
}