rust/tests/compile-fail/null_pointer_deref.rs
2019-04-21 13:18:05 +02:00

5 lines
145 B
Rust

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