Skip to content

Commit 3a2bb78

Browse files
committed
normalize harder
1 parent 1e0747f commit 3a2bb78

File tree

3 files changed

+59
-58
lines changed

3 files changed

+59
-58
lines changed

src/test/ui/const-ptr/forbidden_slices.32bit.stderr

+30-30
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
77
| dereferencing pointer failed: null pointer is not a valid pointer
88
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
99
|
10-
::: $DIR/forbidden_slices.rs:18:34
10+
::: $DIR/forbidden_slices.rs:19:34
1111
|
1212
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
13-
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34
13+
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:19:34
1414

1515
error[E0080]: could not evaluate static initializer
1616
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
@@ -21,10 +21,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
2121
| dereferencing pointer failed: null pointer is not a valid pointer
2222
| inside `std::slice::from_raw_parts::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
2323
|
24-
::: $DIR/forbidden_slices.rs:19:33
24+
::: $DIR/forbidden_slices.rs:20:33
2525
|
2626
LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
27-
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33
27+
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:20:33
2828

2929
error[E0080]: could not evaluate static initializer
3030
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
@@ -35,13 +35,13 @@ LL | &*ptr::slice_from_raw_parts(data, len)
3535
| dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
3636
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
3737
|
38-
::: $DIR/forbidden_slices.rs:22:34
38+
::: $DIR/forbidden_slices.rs:23:34
3939
|
4040
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
41-
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34
41+
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:23:34
4242

4343
error[E0080]: it is undefined behavior to use this value
44-
--> $DIR/forbidden_slices.rs:25:1
44+
--> $DIR/forbidden_slices.rs:26:1
4545
|
4646
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes
@@ -52,7 +52,7 @@ LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }
5252
}
5353

5454
error[E0080]: it is undefined behavior to use this value
55-
--> $DIR/forbidden_slices.rs:27:1
55+
--> $DIR/forbidden_slices.rs:28:1
5656
|
5757
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
5858
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
@@ -63,7 +63,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size
6363
}
6464

6565
error[E0080]: it is undefined behavior to use this value
66-
--> $DIR/forbidden_slices.rs:29:1
66+
--> $DIR/forbidden_slices.rs:30:1
6767
|
6868
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -74,7 +74,7 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4)
7474
}
7575

7676
error[E0080]: it is undefined behavior to use this value
77-
--> $DIR/forbidden_slices.rs:32:1
77+
--> $DIR/forbidden_slices.rs:33:1
7878
|
7979
LL | / pub static S7: &[u16] = unsafe {
8080
LL | |
@@ -86,7 +86,7 @@ LL | | };
8686
|
8787
= 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.
8888
= note: the raw bytes of the constant (size: 8, align: 4) {
89-
╾─a79+0x1─╼ 04 00 00 00 │ ╾──╼....
89+
╾─A_ID+0x1─╼ 04 00 00 00 │ ╾──╼....
9090
}
9191

9292
error[E0080]: could not evaluate static initializer
@@ -98,10 +98,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
9898
| dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
9999
| inside `std::slice::from_raw_parts::<u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
100100
|
101-
::: $DIR/forbidden_slices.rs:43:5
101+
::: $DIR/forbidden_slices.rs:44:5
102102
|
103103
LL | from_raw_parts(ptr, 1)
104-
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5
104+
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:44:5
105105

106106
error[E0080]: could not evaluate static initializer
107107
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -117,10 +117,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
117117
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
118118
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
119119
|
120-
::: $DIR/forbidden_slices.rs:46:34
120+
::: $DIR/forbidden_slices.rs:47:34
121121
|
122122
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
123-
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34
123+
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:47:34
124124

125125
error[E0080]: could not evaluate static initializer
126126
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -136,10 +136,10 @@ LL | assert!(0 < pointee_size && pointee_size <= isize::MAX as usize);
136136
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
137137
| ------------------------------ inside `from_ptr_range::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
138138
|
139-
::: $DIR/forbidden_slices.rs:47:33
139+
::: $DIR/forbidden_slices.rs:48:33
140140
|
141141
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
142-
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33
142+
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:48:33
143143
|
144144
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
145145

@@ -155,13 +155,13 @@ LL | unsafe { intrinsics::offset(self, count) }
155155
LL | unsafe { self.offset(count as isize) }
156156
| --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
157157
|
158-
::: $DIR/forbidden_slices.rs:50:25
158+
::: $DIR/forbidden_slices.rs:51:25
159159
|
160160
LL | from_ptr_range(ptr..ptr.add(2))
161-
| ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25
161+
| ---------- inside `R2` at $DIR/forbidden_slices.rs:51:25
162162

163163
error[E0080]: it is undefined behavior to use this value
164-
--> $DIR/forbidden_slices.rs:52:1
164+
--> $DIR/forbidden_slices.rs:53:1
165165
|
166166
LL | / pub static R4: &[u8] = unsafe {
167167
LL | |
@@ -176,7 +176,7 @@ LL | | };
176176
}
177177

178178
error[E0080]: it is undefined behavior to use this value
179-
--> $DIR/forbidden_slices.rs:57:1
179+
--> $DIR/forbidden_slices.rs:58:1
180180
|
181181
LL | / pub static R5: &[u8] = unsafe {
182182
LL | |
@@ -191,7 +191,7 @@ LL | | };
191191
}
192192

193193
error[E0080]: it is undefined behavior to use this value
194-
--> $DIR/forbidden_slices.rs:62:1
194+
--> $DIR/forbidden_slices.rs:63:1
195195
|
196196
LL | / pub static R6: &[bool] = unsafe {
197197
LL | |
@@ -206,7 +206,7 @@ LL | | };
206206
}
207207

208208
error[E0080]: it is undefined behavior to use this value
209-
--> $DIR/forbidden_slices.rs:67:1
209+
--> $DIR/forbidden_slices.rs:68:1
210210
|
211211
LL | / pub static R7: &[u16] = unsafe {
212212
LL | |
@@ -217,7 +217,7 @@ LL | | };
217217
|
218218
= 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.
219219
= note: the raw bytes of the constant (size: 8, align: 4) {
220-
a209+0x1─╼ 04 00 00 00 │ ╾──╼....
220+
A_ID+0x1─╼ 04 00 00 00 │ ╾──╼....
221221
}
222222

223223
error[E0080]: could not evaluate static initializer
@@ -232,10 +232,10 @@ LL | unsafe { intrinsics::offset(self, count) }
232232
LL | unsafe { self.offset(count as isize) }
233233
| --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
234234
|
235-
::: $DIR/forbidden_slices.rs:74:25
235+
::: $DIR/forbidden_slices.rs:75:25
236236
|
237237
LL | from_ptr_range(ptr..ptr.add(1))
238-
| ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25
238+
| ---------- inside `R8` at $DIR/forbidden_slices.rs:75:25
239239

240240
error[E0080]: could not evaluate static initializer
241241
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -251,10 +251,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
251251
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
252252
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
253253
|
254-
::: $DIR/forbidden_slices.rs:79:34
254+
::: $DIR/forbidden_slices.rs:80:34
255255
|
256256
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
257-
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34
257+
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:80:34
258258

259259
error[E0080]: could not evaluate static initializer
260260
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -270,10 +270,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
270270
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
271271
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
272272
|
273-
::: $DIR/forbidden_slices.rs:80:35
273+
::: $DIR/forbidden_slices.rs:81:35
274274
|
275275
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
276-
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35
276+
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:81:35
277277

278278
error: aborting due to 18 previous errors
279279

0 commit comments

Comments
 (0)