fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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