]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/intrinsics/ptr_offset_from_oob.rs
Rollup merge of #99578 - steffahn:remove_redundant_bound, r=thomcc
[rust.git] / src / tools / miri / tests / fail / intrinsics / ptr_offset_from_oob.rs
1 fn main() {
2     let start_ptr = &4 as *const _ as *const u8;
3     let length = 10;
4     let end_ptr = start_ptr.wrapping_add(length);
5     // Even if the offset is 0, a dangling OOB pointer is not allowed.
6     unsafe { end_ptr.offset_from(end_ptr) }; //~ERROR: pointer at offset 10 is out-of-bounds
7 }