fork/rust

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

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

master
10.6 KiB238 linesraw
1error[E0080]: could not evaluate static initializer
2  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
3   |
4   = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
5   |
6note: inside `std::slice::from_raw_parts::<'_, u32>`
7  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
8note: inside `S0`
9  --> $DIR/forbidden_slices.rs:19:34
10   |
11LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
12   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14error[E0080]: could not evaluate static initializer
15  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
16   |
17   = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
18   |
19note: inside `std::slice::from_raw_parts::<'_, ()>`
20  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
21note: inside `S1`
22  --> $DIR/forbidden_slices.rs:20:33
23   |
24LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
25   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27error[E0080]: could not evaluate static initializer
28  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
29   |
30   = note: dereferencing pointer failed: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
31   |
32note: inside `std::slice::from_raw_parts::<'_, u32>`
33  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
34note: inside `S2`
35  --> $DIR/forbidden_slices.rs:23:34
36   |
37LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
38   |                                  ^^^^^^^^^^^^^^^^^^^^^^
39
40error[E0080]: it is undefined behavior to use this value
41  --> $DIR/forbidden_slices.rs:26:1
42   |
43LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
44   | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
45   |
46   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
47   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
48               HEX_DUMP
49           }
50
51error[E0080]: it is undefined behavior to use this value
52  --> $DIR/forbidden_slices.rs:28:1
53   |
54LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
55   | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
56   |
57   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
58   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
59               HEX_DUMP
60           }
61   = help: this code performed an operation that depends on the underlying bytes representing a pointer
62   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
63
64error[E0080]: it is undefined behavior to use this value
65  --> $DIR/forbidden_slices.rs:30:1
66   |
67LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
68   | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
69   |
70   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
71   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
72               HEX_DUMP
73           }
74
75error[E0080]: it is undefined behavior to use this value
76  --> $DIR/forbidden_slices.rs:33:1
77   |
78LL | pub static S7: &[u16] = unsafe {
79   | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
80   |
81   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
82   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
83               HEX_DUMP
84           }
85
86error[E0080]: could not evaluate static initializer
87  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
88   |
89   = note: dereferencing pointer failed: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
90   |
91note: inside `std::slice::from_raw_parts::<'_, u64>`
92  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
93note: inside `S8`
94  --> $DIR/forbidden_slices.rs:44:5
95   |
96LL |     from_raw_parts(ptr, 1)
97   |     ^^^^^^^^^^^^^^^^^^^^^^
98
99error[E0080]: could not evaluate static initializer
100  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
101   |
102   = note: out-of-bounds `offset_from`: null pointer is a dangling pointer (it has no provenance)
103   |
104note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
105  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
106note: inside `from_ptr_range::<'_, u32>`
107  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
108note: inside `R0`
109  --> $DIR/forbidden_slices.rs:47:34
110   |
111LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
112   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113
114error[E0080]: could not evaluate static initializer
115  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
116   |
117   = note: the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
118   |
119note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr`
120  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
121note: inside `from_ptr_range::<'_, ()>`
122  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
123note: inside `R1`
124  --> $DIR/forbidden_slices.rs:48:33
125   |
126LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
127   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
129
130error[E0080]: could not evaluate static initializer
131  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
132   |
133   = note: out-of-bounds pointer arithmetic: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
134   |
135note: inside `ptr::const_ptr::<impl *const u32>::add`
136  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
137note: inside `R2`
138  --> $DIR/forbidden_slices.rs:51:25
139   |
140LL |     from_ptr_range(ptr..ptr.add(2))
141   |                         ^^^^^^^^^^
142
143error[E0080]: it is undefined behavior to use this value
144  --> $DIR/forbidden_slices.rs:53:1
145   |
146LL | pub static R4: &[u8] = unsafe {
147   | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
148   |
149   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
150   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
151               HEX_DUMP
152           }
153
154error[E0080]: it is undefined behavior to use this value
155  --> $DIR/forbidden_slices.rs:58:1
156   |
157LL | pub static R5: &[u8] = unsafe {
158   | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
159   |
160   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
161   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
162               HEX_DUMP
163           }
164   = help: this code performed an operation that depends on the underlying bytes representing a pointer
165   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
166
167error[E0080]: it is undefined behavior to use this value
168  --> $DIR/forbidden_slices.rs:63:1
169   |
170LL | pub static R6: &[bool] = unsafe {
171   | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
172   |
173   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
174   = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
175               HEX_DUMP
176           }
177
178error[E0080]: could not evaluate static initializer
179  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
180   |
181   = note: accessing memory with alignment 1, but alignment 2 is required
182   |
183note: inside `std::slice::from_raw_parts::<'_, u16>`
184  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
185note: inside `from_ptr_range::<'_, u16>`
186  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
187note: inside `R7`
188  --> $DIR/forbidden_slices.rs:70:5
189   |
190LL |     from_ptr_range(ptr..ptr.add(4))
191   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192
193error[E0080]: could not evaluate static initializer
194  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
195   |
196   = note: out-of-bounds pointer arithmetic: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
197   |
198note: inside `ptr::const_ptr::<impl *const u64>::add`
199  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
200note: inside `R8`
201  --> $DIR/forbidden_slices.rs:74:25
202   |
203LL |     from_ptr_range(ptr..ptr.add(1))
204   |                         ^^^^^^^^^^
205
206error[E0080]: could not evaluate static initializer
207  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
208   |
209   = note: `ptr_offset_from_unsigned` called on pointers into different allocations
210   |
211note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
212  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
213note: inside `from_ptr_range::<'_, u32>`
214  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
215note: inside `R9`
216  --> $DIR/forbidden_slices.rs:79:34
217   |
218LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
219   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
220
221error[E0080]: could not evaluate static initializer
222  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
223   |
224   = note: `ptr_offset_from_unsigned` called on pointers into different allocations
225   |
226note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
227  --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
228note: inside `from_ptr_range::<'_, u32>`
229  --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
230note: inside `R10`
231  --> $DIR/forbidden_slices.rs:80:35
232   |
233LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
234   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^
235
236error: aborting due to 18 previous errors
237
238For more information about this error, try `rustc --explain E0080`.