rust/tests/compile-fail/null_pointer_deref.rs
2017-06-20 14:28:18 +02:00

5 lines
177 B
Rust

fn main() {
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR: a memory access tried to interpret some bytes as a pointer
panic!("this should never print: {}", x);
}