]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/intrinsics/ptr_offset_0_plus_0.rs
Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebank
[rust.git] / src / tools / miri / tests / fail / intrinsics / ptr_offset_0_plus_0.rs
1 //@compile-flags: -Zmiri-permissive-provenance
2
3 #[rustfmt::skip] // fails with "left behind trailing whitespace"
4 fn main() {
5     let x = 0 as *mut i32;
6     let _x = x.wrapping_offset(8); // ok, this has no inbounds tag
7     let _x = unsafe { x.offset(0) }; // UB despite offset 0, NULL is never inbounds
8     //~^ERROR: null pointer is a dangling pointer
9 }