1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
error[E0080]: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
--> $DIR/offset_from_ub.rs:20:27
|
LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `DIFFERENT_ALLOC` failed here
error[E0080]: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
--> $DIR/offset_from_ub.rs:26:14
|
LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `NOT_PTR` failed inside this call
|
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
error[E0080]: exact_div: 1_isize cannot be divided by 2_isize without remainder
--> $DIR/offset_from_ub.rs:34:14
|
LL | unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `NOT_MULTIPLE_OF_SIZE` failed here
error[E0080]: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
--> $DIR/offset_from_ub.rs:42:14
|
LL | unsafe { ptr_offset_from(ptr2, ptr1) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `DIFFERENT_INT` failed here
error[E0080]: `ptr_offset_from` called on two different pointers where the memory range between them is not in-bounds of an allocation
--> $DIR/offset_from_ub.rs:51:14
|
LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `OUT_OF_BOUNDS_1` failed here
error[E0080]: `ptr_offset_from` called on two different pointers where the memory range between them is not in-bounds of an allocation
--> $DIR/offset_from_ub.rs:60:14
|
LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `OUT_OF_BOUNDS_2` failed here
error[E0080]: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation
--> $DIR/offset_from_ub.rs:69:14
|
LL | unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `DIFFERENT_ALLOC_UNSIGNED` failed here
error[E0080]: `ptr_offset_from` called when first pointer is too far ahead of second
--> $DIR/offset_from_ub.rs:76:14
|
LL | unsafe { ptr_offset_from(ptr2, ptr1) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TOO_FAR_APART1` failed here
error[E0080]: `ptr_offset_from` called when first pointer is too far before second
--> $DIR/offset_from_ub.rs:82:14
|
LL | unsafe { ptr_offset_from(ptr1, ptr2) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TOO_FAR_APART2` failed here
error[E0080]: `ptr_offset_from` called when first pointer is too far before second
--> $DIR/offset_from_ub.rs:90:14
|
LL | unsafe { ptr_offset_from(ptr1, ptr2) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TOO_FAR_APART3` failed here
error[E0080]: `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 8
--> $DIR/offset_from_ub.rs:97:14
|
LL | unsafe { ptr_offset_from_unsigned(p, p.add(2)) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `WRONG_ORDER_UNSIGNED` failed here
error[E0080]: `ptr_offset_from_unsigned` called when first pointer is too far ahead of second
--> $DIR/offset_from_ub.rs:104:14
|
LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `TOO_FAR_APART_UNSIGNED` failed here
error[E0080]: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation
--> $DIR/offset_from_ub.rs:112:14
|
LL | unsafe { ptr2.offset_from(ptr1) }
| ^^^^^^^^^^^^^^^^^^^^^^ evaluation of `OFFSET_VERY_FAR1` failed inside this call
|
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
error[E0080]: `ptr_offset_from` called when first pointer is too far before second
--> $DIR/offset_from_ub.rs:118:14
|
LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `OFFSET_VERY_FAR2` failed inside this call
|
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0080`.
|