]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/intrinsics/ptr_offset_ptr_plus_0.rs
Rollup merge of #105375 - WaffleLapkin:docfix, r=cjgillot
[rust.git] / src / tools / miri / tests / fail / intrinsics / ptr_offset_ptr_plus_0.rs
1 #[rustfmt::skip] // fails with "left behind trailing whitespace"
2 fn main() {
3     let x = Box::into_raw(Box::new(0u32));
4     let x = x.wrapping_offset(8); // ok, this has no inbounds tag
5     let _x = unsafe { x.offset(0) }; // UB despite offset 0, the pointer is not inbounds of the only object it can point to
6     //~^ERROR: pointer at offset 32 is out-of-bounds
7 }