File: offset_ub.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 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; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (146 lines) | stat: -rw-r--r-- 6,877 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to the end of 1 byte of memory, but got ALLOC0 which is at the beginning of the allocation
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `BEFORE_START`
  --> $DIR/offset_ub.rs:8:46
   |
LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC1 which is only 1 byte from the end of the allocation
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `AFTER_END`
  --> $DIR/offset_ub.rs:9:43
   |
LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got ALLOC2 which is only $BYTES bytes from the end of the allocation
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `AFTER_ARRAY`
  --> $DIR/offset_ub.rs:10:45
   |
LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize`
   |
note: inside `std::ptr::const_ptr::<impl *const u16>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `OVERFLOW`
  --> $DIR/offset_ub.rs:12:43
   |
LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: overflowing pointer arithmetic: the total offset in bytes does not fit in an `isize`
   |
note: inside `std::ptr::const_ptr::<impl *const u16>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `UNDERFLOW`
  --> $DIR/offset_ub.rs:13:44
   |
LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0xf..f[noalloc] which is a dangling pointer (it has no provenance)
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `OVERFLOW_ADDRESS_SPACE`
  --> $DIR/offset_ub.rs:14:56
   |
LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance)
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `UNDERFLOW_ADDRESS_SPACE`
  --> $DIR/offset_ub.rs:15:57
   |
LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
   |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got ALLOC3-0x2 which points to before the beginning of the allocation
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `NEGATIVE_OFFSET`
  --> $DIR/offset_ub.rs:16:49
   |
LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to 1 byte of memory, but got ALLOC4 which is at or beyond the end of the allocation of size $BYTES bytes
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `ZERO_SIZED_ALLOC`
  --> $DIR/offset_ub.rs:18:50
   |
LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to $BYTES bytes of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance)
   |
note: inside `std::ptr::mut_ptr::<impl *mut u8>::offset`
  --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
note: inside `DANGLING`
  --> $DIR/offset_ub.rs:19:42
   |
LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0080]: evaluation of constant value failed
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
   |
   = note: out-of-bounds pointer arithmetic: expected a pointer to the end of $BYTES bytes of memory, but got 0xf..f[noalloc] which is a dangling pointer (it has no provenance)
   |
note: inside `std::ptr::const_ptr::<impl *const u8>::offset`
  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `UNDERFLOW_ABS`
  --> $DIR/offset_ub.rs:22:47
   |
LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 11 previous errors

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