fork/rust

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

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

master
6.5 KiB159 linesraw
1error[E0080]: evaluation of constant value failed
2  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
3   |
4   = note: overflowing in-bounds pointer arithmetic
5   |
6note: inside `ptr::const_ptr::<impl *const u8>::offset`
7  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
8note: inside `BEFORE_START`
9  --> $DIR/offset_ub.rs:7:46
10   |
11LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
12   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14error[E0080]: evaluation of constant value failed
15  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
16   |
17   = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
18   |
19note: inside `ptr::const_ptr::<impl *const u8>::offset`
20  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
21note: inside `AFTER_END`
22  --> $DIR/offset_ub.rs:8:43
23   |
24LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
25   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27error[E0080]: evaluation of constant value failed
28  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
29   |
30   = note: out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
31   |
32note: inside `ptr::const_ptr::<impl *const u8>::offset`
33  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
34note: inside `AFTER_ARRAY`
35  --> $DIR/offset_ub.rs:9:45
36   |
37LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
38   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
40error[E0080]: evaluation of constant value failed
41  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
42   |
43   = note: overflowing in-bounds pointer arithmetic
44   |
45note: inside `ptr::const_ptr::<impl *const u16>::offset`
46  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
47note: inside `OVERFLOW`
48  --> $DIR/offset_ub.rs:11:43
49   |
50LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
51   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52
53error[E0080]: evaluation of constant value failed
54  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
55   |
56   = note: overflowing in-bounds pointer arithmetic
57   |
58note: inside `ptr::const_ptr::<impl *const u16>::offset`
59  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
60note: inside `UNDERFLOW`
61  --> $DIR/offset_ub.rs:12:44
62   |
63LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
64   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65
66error[E0080]: evaluation of constant value failed
67  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
68   |
69   = note: overflowing in-bounds pointer arithmetic
70   |
71note: inside `ptr::const_ptr::<impl *const u8>::offset`
72  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
73note: inside `OVERFLOW_ADDRESS_SPACE`
74  --> $DIR/offset_ub.rs:13:56
75   |
76LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
77   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78
79error[E0080]: evaluation of constant value failed
80  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
81   |
82   = note: overflowing in-bounds pointer arithmetic
83   |
84note: inside `ptr::const_ptr::<impl *const u8>::offset`
85  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
86note: inside `UNDERFLOW_ADDRESS_SPACE`
87  --> $DIR/offset_ub.rs:14:57
88   |
89LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
90   |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
92error[E0080]: evaluation of constant value failed
93  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
94   |
95   = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
96   |
97note: inside `ptr::const_ptr::<impl *const u8>::offset`
98  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
99note: inside `NEGATIVE_OFFSET`
100  --> $DIR/offset_ub.rs:15:49
101   |
102LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
103   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
105error[E0080]: evaluation of constant value failed
106  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
107   |
108   = note: out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
109   |
110note: inside `ptr::const_ptr::<impl *const u8>::offset`
111  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
112note: inside `ZERO_SIZED_ALLOC`
113  --> $DIR/offset_ub.rs:17:50
114   |
115LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
116   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
118error[E0080]: evaluation of constant value failed
119  --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
120   |
121   = note: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
122   |
123note: inside `ptr::mut_ptr::<impl *mut u8>::offset`
124  --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
125note: inside `DANGLING`
126  --> $DIR/offset_ub.rs:18:42
127   |
128LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
129   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
130
131error[E0080]: evaluation of constant value failed
132  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
133   |
134   = note: out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
135   |
136note: inside `ptr::const_ptr::<impl *const u8>::offset`
137  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
138note: inside `NULL_OFFSET_ZERO`
139  --> $DIR/offset_ub.rs:21:50
140   |
141LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
142   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
143
144error[E0080]: evaluation of constant value failed
145  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
146   |
147   = note: out-of-bounds pointer arithmetic: 0x7f..f[noalloc] is a dangling pointer (it has no provenance)
148   |
149note: inside `ptr::const_ptr::<impl *const u8>::offset`
150  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
151note: inside `UNDERFLOW_ABS`
152  --> $DIR/offset_ub.rs:24:47
153   |
154LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
155   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156
157error: aborting due to 12 previous errors
158
159For more information about this error, try `rustc --explain E0080`.