rust/tests/fail/dangling_pointers/null_pointer_write.rs

5 lines
128 B
Rust
Raw Normal View History

2021-04-15 10:00:39 +02:00
#[allow(deref_nullptr)]
fn main() {
2022-07-05 18:16:20 -04:00
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is a dangling pointer
}