mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
8 lines
239 B
Rust
8 lines
239 B
Rust
// error-pattern: invalid use of NULL pointer
|
|
|
|
fn main() {
|
|
let x = 0 as *mut i32;
|
|
let _x = x.wrapping_offset(8); // ok, this has no inbounds tag
|
|
let _x = unsafe { x.offset(0) }; // UB despite offset 0, NULL is never inbounds
|
|
}
|