1 error: any use of this value will cause an error
2 --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
4 LL | intrinsics::ptr_offset_from(self, origin)
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | ptr_offset_from cannot compute offset of pointers into different allocations.
8 | inside call to `std::ptr::const_ptr::<impl *const Struct>::offset_from` at $DIR/offset_from_ub.rs:22:27
10 ::: $DIR/offset_from_ub.rs:16:1
12 LL | / pub const DIFFERENT_ALLOC: usize = {
14 LL | | let uninit = std::mem::MaybeUninit::<Struct>::uninit();
15 LL | | let base_ptr: *const Struct = &uninit as *const _ as *const Struct;
17 LL | | offset as usize
21 = note: `#[deny(const_err)]` on by default
23 error: any use of this value will cause an error
24 --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
26 LL | intrinsics::ptr_offset_from(self, origin)
27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29 | unable to turn bytes into a pointer
30 | inside call to `std::ptr::const_ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:28:14
32 ::: $DIR/offset_from_ub.rs:26:1
34 LL | / pub const NOT_PTR: usize = {
36 LL | | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
40 error: any use of this value will cause an error
41 --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
43 LL | intrinsics::ptr_offset_from(self, origin)
44 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46 | exact_div: 1isize cannot be divided by 2isize without remainder
47 | inside call to `std::ptr::const_ptr::<impl *const u16>::offset_from` at $DIR/offset_from_ub.rs:36:14
49 ::: $DIR/offset_from_ub.rs:31:1
51 LL | / pub const NOT_MULTIPLE_OF_SIZE: isize = {
53 LL | | let data = [5u8, 6, 7];
54 LL | | let base_ptr = data.as_ptr();
55 LL | | let field_ptr = &data[1] as *const u8 as *const u16;
56 LL | | unsafe { field_ptr.offset_from(base_ptr as *const u16) }
60 error: any use of this value will cause an error
61 --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
63 LL | intrinsics::ptr_offset_from(self, origin)
64 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 | invalid use of NULL pointer
67 | inside call to `std::ptr::const_ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:42:14
69 ::: $DIR/offset_from_ub.rs:39:1
71 LL | / pub const OFFSET_FROM_NULL: isize = {
73 LL | | let ptr = 0 as *const u8;
74 LL | | unsafe { ptr.offset_from(ptr) }
78 error: any use of this value will cause an error
79 --> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
81 LL | intrinsics::ptr_offset_from(self, origin)
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 | unable to turn bytes into a pointer
85 | inside call to `std::ptr::const_ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:49:14
87 ::: $DIR/offset_from_ub.rs:45:1
89 LL | / pub const DIFFERENT_INT: isize = { // offset_from with two different integers: like DIFFERENT_ALLOC
91 LL | | let ptr1 = 8 as *const u8;
92 LL | | let ptr2 = 16 as *const u8;
93 LL | | unsafe { ptr2.offset_from(ptr1) }
97 error: aborting due to 5 previous errors