error: any use of this value will cause an error --> $SRC_DIR/libcore/ptr/mod.rs:LL:COL | LL | intrinsics::ptr_offset_from(self, origin) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | ptr_offset_from cannot compute offset of pointers into different allocations. | inside call to `std::ptr::::offset_from` at $DIR/offset_from_ub.rs:19:27 | ::: $DIR/offset_from_ub.rs:13:1 | LL | / pub const DIFFERENT_ALLOC: usize = { LL | | LL | | let uninit = std::mem::MaybeUninit::::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/mod.rs:LL:COL | LL | intrinsics::ptr_offset_from(self, origin) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | a memory access tried to interpret some bytes as a pointer | inside call to `std::ptr::::offset_from` at $DIR/offset_from_ub.rs:25:14 | ::: $DIR/offset_from_ub.rs:23: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/mod.rs:LL:COL | LL | intrinsics::ptr_offset_from(self, origin) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | exact_div: 1 cannot be divided by 2 without remainder | inside call to `std::ptr::::offset_from` at $DIR/offset_from_ub.rs:33:27 | ::: $DIR/offset_from_ub.rs:28:1 | LL | / pub const NOT_MULTIPLE_OF_SIZE: usize = { LL | | LL | | let data = [5u8, 6, 7]; LL | | let base_ptr = data.as_ptr(); ... | LL | | offset as usize LL | | }; | |__- error: aborting due to 3 previous errors