]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/offset_from_ub.stderr
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / consts / offset_from_ub.stderr
CommitLineData
136023e0 1error[E0080]: evaluation of constant value failed
064997fb 2 --> $DIR/offset_from_ub.rs:18:27
e74abb32 3 |
136023e0 4LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
064997fb 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on pointers into different allocations
e74abb32 6
136023e0 7error[E0080]: evaluation of constant value failed
3dfed10e 8 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
e74abb32 9 |
136023e0
XL
10LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 | |
064997fb 13 | `ptr_offset_from` called on pointers into different allocations
136023e0 14 | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
94222f64 15 |
064997fb 16 ::: $DIR/offset_from_ub.rs:24:14
5869c6ff 17 |
136023e0 18LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
064997fb 19 | ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:24:14
e74abb32 20
136023e0 21error[E0080]: evaluation of constant value failed
064997fb 22 --> $DIR/offset_from_ub.rs:31:14
5869c6ff 23 |
136023e0
XL
24LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder
60c5eb7d 26
136023e0 27error[E0080]: evaluation of constant value failed
064997fb 28 --> $DIR/offset_from_ub.rs:37:14
5869c6ff 29 |
136023e0 30LL | unsafe { ptr_offset_from(ptr, ptr) }
064997fb 31 | ^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
60c5eb7d 32
136023e0 33error[E0080]: evaluation of constant value failed
064997fb 34 --> $DIR/offset_from_ub.rs:44:14
5869c6ff 35 |
136023e0 36LL | unsafe { ptr_offset_from(ptr2, ptr1) }
064997fb 37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: 0x8[noalloc] is a dangling pointer (it has no provenance)
e74abb32 38
5e7ed085 39error[E0080]: evaluation of constant value failed
064997fb 40 --> $DIR/offset_from_ub.rs:53:14
5e7ed085
FG
41 |
42LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
064997fb 43 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc18 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
5e7ed085
FG
44
45error[E0080]: evaluation of constant value failed
064997fb 46 --> $DIR/offset_from_ub.rs:62:14
5e7ed085
FG
47 |
48LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
064997fb 49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc21 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
5e7ed085
FG
50
51error[E0080]: evaluation of constant value failed
064997fb 52 --> $DIR/offset_from_ub.rs:70:14
5e7ed085
FG
53 |
54LL | unsafe { ptr_offset_from(end_ptr, end_ptr) }
064997fb 55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc24 has size 4, so pointer at offset 10 is out-of-bounds
5e7ed085 56
04454e1e 57error[E0080]: evaluation of constant value failed
064997fb 58 --> $DIR/offset_from_ub.rs:79:14
04454e1e 59 |
064997fb
FG
60LL | unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }
61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on pointers into different allocations
04454e1e
FG
62
63error[E0080]: evaluation of constant value failed
64 --> $DIR/offset_from_ub.rs:86:14
65 |
064997fb
FG
66LL | unsafe { ptr_offset_from(ptr2, ptr1) }
67 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far ahead of second
68
69error[E0080]: evaluation of constant value failed
70 --> $DIR/offset_from_ub.rs:92:14
71 |
72LL | unsafe { ptr_offset_from(ptr1, ptr2) }
73 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second
74
75error[E0080]: evaluation of constant value failed
76 --> $DIR/offset_from_ub.rs:99:14
77 |
04454e1e 78LL | unsafe { ptr_offset_from_unsigned(p, p.add(2) ) }
064997fb
FG
79 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 8
80
81error[E0080]: evaluation of constant value failed
82 --> $DIR/offset_from_ub.rs:106:14
83 |
84LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) }
85 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer is too far ahead of second
86
87error[E0080]: evaluation of constant value failed
88 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
89 |
90LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
91 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92 | |
93 | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
94 | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
95 |
96 ::: $DIR/offset_from_ub.rs:115:14
97 |
98LL | unsafe { ptr2.offset_from(ptr1) }
99 | ---------------------- inside `OFFSET_VERY_FAR1` at $DIR/offset_from_ub.rs:115:14
100
101error[E0080]: evaluation of constant value failed
102 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
103 |
104LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
105 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106 | |
107 | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
108 | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
109 |
110 ::: $DIR/offset_from_ub.rs:121:14
111 |
112LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) }
113 | ----------------------------------------- inside `OFFSET_VERY_FAR2` at $DIR/offset_from_ub.rs:121:14
04454e1e 114
064997fb 115error: aborting due to 15 previous errors
e74abb32 116
136023e0 117For more information about this error, try `rustc --explain E0080`.