| error: any use of this value will cause an error |
| --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | |
| LL | unsafe { intrinsics::ptr_offset_from(self, origin) } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | ptr_offset_from cannot compute offset of pointers into different allocations. |
| | inside `std::ptr::const_ptr::<impl *const Struct>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | inside `DIFFERENT_ALLOC` at $DIR/offset_from_ub.rs:17:27 |
| | |
| ::: $DIR/offset_from_ub.rs:11:1 |
| | |
| LL | / pub const DIFFERENT_ALLOC: usize = { |
| LL | | |
| LL | | let uninit = std::mem::MaybeUninit::<Struct>::uninit(); |
| LL | | let base_ptr: *const Struct = &uninit as *const _ as *const Struct; |
| ... | |
| LL | | offset as usize |
| LL | | }; |
| | |__- |
| | |
| = note: `#[deny(const_err)]` on by default |
| |
| error: any use of this value will cause an error |
| --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | |
| LL | unsafe { intrinsics::ptr_offset_from(self, origin) } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | unable to turn bytes into a pointer |
| | inside `std::ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | inside `NOT_PTR` at $DIR/offset_from_ub.rs:23:14 |
| | |
| ::: $DIR/offset_from_ub.rs:21:1 |
| | |
| LL | / pub const NOT_PTR: usize = { |
| LL | | |
| LL | | unsafe { (42 as *const u8).offset_from(&5u8) as usize } |
| LL | | }; |
| | |__- |
| |
| error: any use of this value will cause an error |
| --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | |
| LL | unsafe { intrinsics::ptr_offset_from(self, origin) } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | exact_div: 1_isize cannot be divided by 2_isize without remainder |
| | inside `std::ptr::const_ptr::<impl *const u16>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | inside `NOT_MULTIPLE_OF_SIZE` at $DIR/offset_from_ub.rs:31:14 |
| | |
| ::: $DIR/offset_from_ub.rs:26:1 |
| | |
| LL | / pub const NOT_MULTIPLE_OF_SIZE: isize = { |
| LL | | |
| LL | | let data = [5u8, 6, 7]; |
| LL | | let base_ptr = data.as_ptr(); |
| LL | | let field_ptr = &data[1] as *const u8 as *const u16; |
| LL | | unsafe { field_ptr.offset_from(base_ptr as *const u16) } |
| LL | | }; |
| | |__- |
| |
| error: any use of this value will cause an error |
| --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | |
| LL | unsafe { intrinsics::ptr_offset_from(self, origin) } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | inbounds test failed: 0x0 is not a valid pointer |
| | inside `std::ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | inside `OFFSET_FROM_NULL` at $DIR/offset_from_ub.rs:37:14 |
| | |
| ::: $DIR/offset_from_ub.rs:34:1 |
| | |
| LL | / pub const OFFSET_FROM_NULL: isize = { |
| LL | | |
| LL | | let ptr = 0 as *const u8; |
| LL | | unsafe { ptr.offset_from(ptr) } |
| LL | | }; |
| | |__- |
| |
| error: any use of this value will cause an error |
| --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | |
| LL | unsafe { intrinsics::ptr_offset_from(self, origin) } |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| | | |
| | unable to turn bytes into a pointer |
| | inside `std::ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL |
| | inside `DIFFERENT_INT` at $DIR/offset_from_ub.rs:44:14 |
| | |
| ::: $DIR/offset_from_ub.rs:40:1 |
| | |
| LL | / pub const DIFFERENT_INT: isize = { // offset_from with two different integers: like DIFFERENT_ALLOC |
| LL | | |
| LL | | let ptr1 = 8 as *const u8; |
| LL | | let ptr2 = 16 as *const u8; |
| LL | | unsafe { ptr2.offset_from(ptr1) } |
| LL | | }; |
| | |__- |
| |
| error: aborting due to 5 previous errors |
| |