1 error[E0080]: evaluation of constant value failed
2 --> $DIR/offset_from_ub.rs:17:27
4 LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from cannot compute offset of pointers into different allocations.
7 error[E0080]: evaluation of constant value failed
8 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
10 LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13 | 0x2a is not a valid pointer
14 | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
16 ::: $DIR/offset_from_ub.rs:23:14
18 LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
19 | ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:23:14
21 error[E0080]: evaluation of constant value failed
22 --> $DIR/offset_from_ub.rs:30:14
24 LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder
27 error[E0080]: evaluation of constant value failed
28 --> $DIR/offset_from_ub.rs:36:14
30 LL | unsafe { ptr_offset_from(ptr, ptr) }
31 | ^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not a valid pointer for this operation
33 error[E0080]: evaluation of constant value failed
34 --> $DIR/offset_from_ub.rs:43:14
36 LL | unsafe { ptr_offset_from(ptr2, ptr1) }
37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0x10 is not a valid pointer
39 error: aborting due to 5 previous errors
41 For more information about this error, try `rustc --explain E0080`.