File: offset_from_ub.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 893,176 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (108 lines) | stat: -rw-r--r-- 4,892 bytes parent folder | download | duplicates (3)
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
97
98
99
100
101
102
103
104
105
106
107
108
error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:19:27
   |
LL |     let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) };
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on pointers into different allocations

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: `ptr_offset_from` called on pointers into different allocations
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `NOT_PTR`
  --> $DIR/offset_from_ub.rs:25:14
   |
LL |     unsafe { (42 as *const u8).offset_from(&5u8) as usize }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:32:14
   |
LL |     unsafe { ptr_offset_from(field_ptr, base_ptr as *const u16) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exact_div: 1_isize cannot be divided by 2_isize without remainder

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:39:14
   |
LL |     unsafe { ptr_offset_from(ptr2, ptr1) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to $BYTES bytes of memory, but got 0x8[noalloc] which is a dangling pointer (it has no provenance)

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:48:14
   |
LL |     unsafe { ptr_offset_from(end_ptr, start_ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to $BYTES bytes of memory, but got ALLOC0 which is only $BYTES bytes from the end of the allocation

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:57:14
   |
LL |     unsafe { ptr_offset_from(start_ptr, end_ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to the end of $BYTES bytes of memory, but got ALLOC1+0xa which does not have enough space to the beginning of the allocation

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:66:14
   |
LL |     unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on pointers into different allocations

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:73:14
   |
LL |     unsafe { ptr_offset_from(ptr2, ptr1) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far ahead of second

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:79:14
   |
LL |     unsafe { ptr_offset_from(ptr1, ptr2) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:87:14
   |
LL |     unsafe { ptr_offset_from(ptr1, ptr2) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called when first pointer is too far before second

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:94:14
   |
LL |     unsafe { ptr_offset_from_unsigned(p, p.add(2) ) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 8

error[E0080]: evaluation of constant value failed
  --> $DIR/offset_from_ub.rs:101:14
   |
LL |     unsafe { ptr_offset_from_unsigned(ptr2, ptr1) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called when first pointer is too far ahead of second

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds `offset_from` origin: expected a pointer to $BYTES bytes of memory, but got a null pointer
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `OFFSET_VERY_FAR1`
  --> $DIR/offset_from_ub.rs:110:14
   |
LL |     unsafe { ptr2.offset_from(ptr1) }
   |              ^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: `ptr_offset_from` called when first pointer is too far before second
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `OFFSET_VERY_FAR2`
  --> $DIR/offset_from_ub.rs:116:14
   |
LL |     unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0080`.