rust/tests/compile-fail/null_pointer_write.rs

5 lines
148 B
Rust
Raw Normal View History

2021-04-15 03:00:39 -05:00
#[allow(deref_nullptr)]
fn main() {
2021-05-08 02:33:27 -05:00
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is not a valid pointer for this operation
}