rust/tests/compile-fail/null_pointer_deref.rs
2021-04-15 10:00:39 +02:00

6 lines
190 B
Rust

#[allow(deref_nullptr)]
fn main() {
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR inbounds test failed: 0x0 is not a valid pointer
panic!("this should never print: {}", x);
}