1
1
error[E0080]: evaluation of constant value failed
2
- --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
3
- |
4
- LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
- | |
7
- | ptr_offset_from cannot compute offset of pointers into different allocations.
8
- | inside `ptr::const_ptr::<impl *const Struct>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
9
- |
10
- ::: $DIR/offset_from_ub.rs:15:27
2
+ --> $DIR/offset_from_ub.rs:18:27
11
3
|
12
- LL | let offset = unsafe { field_ptr.offset_from( base_ptr) };
13
- | ------------------------------- inside `DIFFERENT_ALLOC` at $DIR/offset_from_ub.rs:15: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.
14
6
15
7
error: any use of this value will cause an error
16
8
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -20,12 +12,11 @@ LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
20
12
| |
21
13
| unable to turn bytes into a pointer
22
14
| inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
23
- | inside `NOT_PTR` at $DIR/offset_from_ub.rs:21 :14
15
+ | inside `NOT_PTR` at $DIR/offset_from_ub.rs:24 :14
24
16
|
25
- ::: $DIR/offset_from_ub.rs:19 :1
17
+ ::: $DIR/offset_from_ub.rs:23 :1
26
18
|
27
19
LL | / pub const NOT_PTR: usize = {
28
- LL | |
29
20
LL | | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
30
21
LL | | };
31
22
| |__-
@@ -35,50 +26,26 @@ LL | | };
35
26
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
36
27
37
28
error[E0080]: evaluation of constant value failed
38
- --> $SRC_DIR/core/src/ptr/const_ptr .rs:LL:COL
29
+ --> $DIR/offset_from_ub .rs:31:14
39
30
|
40
- LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
41
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42
- | |
43
- | exact_div: 1_isize cannot be divided by 2_isize without remainder
44
- | inside `ptr::const_ptr::<impl *const u16>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
45
- |
46
- ::: $DIR/offset_from_ub.rs:28:14
47
- |
48
- LL | unsafe { field_ptr.offset_from(base_ptr as *const u16) }
49
- | --------------------------------------------- inside `NOT_MULTIPLE_OF_SIZE` at $DIR/offset_from_ub.rs:28:14
31
+ LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
32
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder
50
33
51
34
error[E0080]: evaluation of constant value failed
52
- --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
53
- |
54
- LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
55
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
- | |
57
- | null pointer is not a valid pointer for this operation
58
- | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
59
- |
60
- ::: $DIR/offset_from_ub.rs:33:14
35
+ --> $DIR/offset_from_ub.rs:37:14
61
36
|
62
- LL | unsafe { ptr.offset_from( ptr) }
63
- | -------------------- inside `OFFSET_FROM_NULL` at $DIR/offset_from_ub.rs:33:14
37
+ LL | unsafe { ptr_offset_from(ptr, ptr) }
38
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not a valid pointer for this operation
64
39
65
40
error: any use of this value will cause an error
66
- --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
67
- |
68
- LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
69
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70
- | |
71
- | unable to turn bytes into a pointer
72
- | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
73
- | inside `DIFFERENT_INT` at $DIR/offset_from_ub.rs:40:14
74
- |
75
- ::: $DIR/offset_from_ub.rs:36:1
41
+ --> $DIR/offset_from_ub.rs:44:14
76
42
|
77
43
LL | / pub const DIFFERENT_INT: isize = { // offset_from with two different integers: like DIFFERENT_ALLOC
78
- LL | |
79
44
LL | | let ptr1 = 8 as *const u8;
80
45
LL | | let ptr2 = 16 as *const u8;
81
- LL | | unsafe { ptr2.offset_from(ptr1) }
46
+ LL | | unsafe { ptr_offset_from(ptr2, ptr1) }
47
+ | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn bytes into a pointer
48
+ LL | |
82
49
LL | | };
83
50
| |__-
84
51
|
0 commit comments