]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/offset_from_ub.stderr
Rollup merge of #94818 - yoshuawuyts:into-future-associated-type, r=joshtriplett
[rust.git] / src / test / ui / consts / offset_from_ub.stderr
1 error[E0080]: evaluation of constant value failed
2   --> $DIR/offset_from_ub.rs:17:27
3    |
4 LL |     let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
5    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from cannot compute offset of pointers into different allocations.
6
7 error[E0080]: evaluation of constant value failed
8   --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
9    |
10 LL |         unsafe { intrinsics::ptr_offset_from(self, origin) }
11    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12    |                  |
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
15    |
16   ::: $DIR/offset_from_ub.rs:23:14
17    |
18 LL |     unsafe { (42 as *const u8).offset_from(&5u8) as usize }
19    |              ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:23:14
20
21 error[E0080]: evaluation of constant value failed
22   --> $DIR/offset_from_ub.rs:30:14
23    |
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
26
27 error[E0080]: evaluation of constant value failed
28   --> $DIR/offset_from_ub.rs:36:14
29    |
30 LL |     unsafe { ptr_offset_from(ptr, ptr) }
31    |              ^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not a valid pointer for this operation
32
33 error[E0080]: evaluation of constant value failed
34   --> $DIR/offset_from_ub.rs:43:14
35    |
36 LL |     unsafe { ptr_offset_from(ptr2, ptr1) }
37    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0x10 is not a valid pointer
38
39 error: aborting due to 5 previous errors
40
41 For more information about this error, try `rustc --explain E0080`.