mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
normalize forbidden slices
This commit is contained in:
parent
1f8a6410bf
commit
1e0747f8d2
@ -7,10 +7,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| dereferencing pointer failed: null pointer is not a valid pointer
|
||||
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:17:34
|
||||
::: $DIR/forbidden_slices.rs:18:34
|
||||
|
|
||||
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
|
||||
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:17:34
|
||||
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
@ -21,10 +21,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| dereferencing pointer failed: null pointer is not a valid pointer
|
||||
| inside `std::slice::from_raw_parts::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:18:33
|
||||
::: $DIR/forbidden_slices.rs:19:33
|
||||
|
|
||||
LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
|
||||
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:18:33
|
||||
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
@ -32,49 +32,49 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| dereferencing pointer failed: alloc26 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:21:34
|
||||
::: $DIR/forbidden_slices.rs:22:34
|
||||
|
|
||||
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
|
||||
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:21:34
|
||||
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:24:1
|
||||
--> $DIR/forbidden_slices.rs:25:1
|
||||
|
|
||||
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 8, align: 4) {
|
||||
╾─alloc42─╼ 01 00 00 00 │ ╾──╼....
|
||||
╾─ALLOC_ID─╼ 01 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:26:1
|
||||
--> $DIR/forbidden_slices.rs:27:1
|
||||
|
|
||||
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 8, align: 4) {
|
||||
╾─alloc55─╼ 04 00 00 00 │ ╾──╼....
|
||||
╾─ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:28:1
|
||||
--> $DIR/forbidden_slices.rs:29:1
|
||||
|
|
||||
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 8, align: 4) {
|
||||
╾─alloc65─╼ 04 00 00 00 │ ╾──╼....
|
||||
╾─ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:31:1
|
||||
--> $DIR/forbidden_slices.rs:32:1
|
||||
|
|
||||
LL | / pub static S7: &[u16] = unsafe {
|
||||
LL | |
|
||||
@ -95,13 +95,13 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| dereferencing pointer failed: alloc96 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| inside `std::slice::from_raw_parts::<u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:42:5
|
||||
::: $DIR/forbidden_slices.rs:43:5
|
||||
|
|
||||
LL | from_raw_parts(ptr, 1)
|
||||
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:42:5
|
||||
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
@ -117,10 +117,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:45:34
|
||||
::: $DIR/forbidden_slices.rs:46:34
|
||||
|
|
||||
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
|
||||
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:45:34
|
||||
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $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);
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:46:33
|
||||
::: $DIR/forbidden_slices.rs:47:33
|
||||
|
|
||||
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
|
||||
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:46:33
|
||||
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33
|
||||
|
|
||||
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@ -149,19 +149,19 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | unsafe { intrinsics::offset(self, count) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| pointer arithmetic failed: alloc154 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| pointer arithmetic failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| inside `ptr::const_ptr::<impl *const u32>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
...
|
||||
LL | unsafe { self.offset(count as isize) }
|
||||
| --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:49:25
|
||||
::: $DIR/forbidden_slices.rs:50:25
|
||||
|
|
||||
LL | from_ptr_range(ptr..ptr.add(2))
|
||||
| ---------- inside `R2` at $DIR/forbidden_slices.rs:49:25
|
||||
| ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:51:1
|
||||
--> $DIR/forbidden_slices.rs:52:1
|
||||
|
|
||||
LL | / pub static R4: &[u8] = unsafe {
|
||||
LL | |
|
||||
@ -172,11 +172,11 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 8, align: 4) {
|
||||
╾alloc159─╼ 01 00 00 00 │ ╾──╼....
|
||||
╾ALLOC_ID─╼ 01 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:56:1
|
||||
--> $DIR/forbidden_slices.rs:57:1
|
||||
|
|
||||
LL | / pub static R5: &[u8] = unsafe {
|
||||
LL | |
|
||||
@ -187,11 +187,11 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 8, align: 4) {
|
||||
╾alloc175─╼ 04 00 00 00 │ ╾──╼....
|
||||
╾ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:61:1
|
||||
--> $DIR/forbidden_slices.rs:62:1
|
||||
|
|
||||
LL | / pub static R6: &[bool] = unsafe {
|
||||
LL | |
|
||||
@ -202,11 +202,11 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 8, align: 4) {
|
||||
╾alloc191─╼ 04 00 00 00 │ ╾──╼....
|
||||
╾ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:66:1
|
||||
--> $DIR/forbidden_slices.rs:67:1
|
||||
|
|
||||
LL | / pub static R7: &[u16] = unsafe {
|
||||
LL | |
|
||||
@ -226,16 +226,16 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | unsafe { intrinsics::offset(self, count) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| pointer arithmetic failed: alloc230 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| pointer arithmetic failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| inside `ptr::const_ptr::<impl *const u64>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
...
|
||||
LL | unsafe { self.offset(count as isize) }
|
||||
| --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:73:25
|
||||
::: $DIR/forbidden_slices.rs:74:25
|
||||
|
|
||||
LL | from_ptr_range(ptr..ptr.add(1))
|
||||
| ---------- inside `R8` at $DIR/forbidden_slices.rs:73:25
|
||||
| ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
@ -251,10 +251,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:78:34
|
||||
::: $DIR/forbidden_slices.rs:79:34
|
||||
|
|
||||
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
|
||||
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:78:34
|
||||
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
@ -270,10 +270,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:79:35
|
||||
::: $DIR/forbidden_slices.rs:80:35
|
||||
|
|
||||
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
|
||||
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:79:35
|
||||
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
|
@ -7,10 +7,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| dereferencing pointer failed: null pointer is not a valid pointer
|
||||
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:17:34
|
||||
::: $DIR/forbidden_slices.rs:18:34
|
||||
|
|
||||
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
|
||||
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:17:34
|
||||
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
@ -21,10 +21,10 @@ LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| dereferencing pointer failed: null pointer is not a valid pointer
|
||||
| inside `std::slice::from_raw_parts::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:18:33
|
||||
::: $DIR/forbidden_slices.rs:19:33
|
||||
|
|
||||
LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
|
||||
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:18:33
|
||||
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
@ -32,49 +32,49 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| dereferencing pointer failed: alloc26 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:21:34
|
||||
::: $DIR/forbidden_slices.rs:22:34
|
||||
|
|
||||
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
|
||||
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:21:34
|
||||
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:24:1
|
||||
--> $DIR/forbidden_slices.rs:25:1
|
||||
|
|
||||
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered uninitialized bytes
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾───────alloc42───────╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾───────ALLOC_ID───────╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:26:1
|
||||
--> $DIR/forbidden_slices.rs:27:1
|
||||
|
|
||||
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾───────alloc55───────╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾───────ALLOC_ID───────╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:28:1
|
||||
--> $DIR/forbidden_slices.rs:29:1
|
||||
|
|
||||
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<deref>[0]: encountered 0x11, but expected a boolean
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾───────alloc65───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾───────ALLOC_ID───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:31:1
|
||||
--> $DIR/forbidden_slices.rs:32:1
|
||||
|
|
||||
LL | / pub static S7: &[u16] = unsafe {
|
||||
LL | |
|
||||
@ -86,7 +86,7 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾─────alloc79+0x1─────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾─────ALLOC_ID+0x1─────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
@ -95,13 +95,13 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | &*ptr::slice_from_raw_parts(data, len)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| dereferencing pointer failed: alloc96 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| inside `std::slice::from_raw_parts::<u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:42:5
|
||||
::: $DIR/forbidden_slices.rs:43:5
|
||||
|
|
||||
LL | from_raw_parts(ptr, 1)
|
||||
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:42:5
|
||||
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
@ -117,10 +117,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:45:34
|
||||
::: $DIR/forbidden_slices.rs:46:34
|
||||
|
|
||||
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
|
||||
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:45:34
|
||||
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $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);
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:46:33
|
||||
::: $DIR/forbidden_slices.rs:47:33
|
||||
|
|
||||
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
|
||||
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:46:33
|
||||
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33
|
||||
|
|
||||
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@ -149,19 +149,19 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | unsafe { intrinsics::offset(self, count) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| pointer arithmetic failed: alloc154 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| pointer arithmetic failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
||||
| inside `ptr::const_ptr::<impl *const u32>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
...
|
||||
LL | unsafe { self.offset(count as isize) }
|
||||
| --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:49:25
|
||||
::: $DIR/forbidden_slices.rs:50:25
|
||||
|
|
||||
LL | from_ptr_range(ptr..ptr.add(2))
|
||||
| ---------- inside `R2` at $DIR/forbidden_slices.rs:49:25
|
||||
| ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:51:1
|
||||
--> $DIR/forbidden_slices.rs:52:1
|
||||
|
|
||||
LL | / pub static R4: &[u8] = unsafe {
|
||||
LL | |
|
||||
@ -172,11 +172,11 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾──────alloc159───────╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾──────ALLOC_ID───────╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:56:1
|
||||
--> $DIR/forbidden_slices.rs:57:1
|
||||
|
|
||||
LL | / pub static R5: &[u8] = unsafe {
|
||||
LL | |
|
||||
@ -187,11 +187,11 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾──────alloc175───────╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾──────ALLOC_ID───────╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:61:1
|
||||
--> $DIR/forbidden_slices.rs:62:1
|
||||
|
|
||||
LL | / pub static R6: &[bool] = unsafe {
|
||||
LL | |
|
||||
@ -202,11 +202,11 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾──────alloc191───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾──────ALLOC_ID───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/forbidden_slices.rs:66:1
|
||||
--> $DIR/forbidden_slices.rs:67:1
|
||||
|
|
||||
LL | / pub static R7: &[u16] = unsafe {
|
||||
LL | |
|
||||
@ -217,7 +217,7 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
= note: the raw bytes of the constant (size: 16, align: 8) {
|
||||
╾────alloc209+0x1─────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾────ALLOC_ID+0x1─────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
@ -226,16 +226,16 @@ error[E0080]: could not evaluate static initializer
|
||||
LL | unsafe { intrinsics::offset(self, count) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| pointer arithmetic failed: alloc230 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| pointer arithmetic failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
||||
| inside `ptr::const_ptr::<impl *const u64>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
...
|
||||
LL | unsafe { self.offset(count as isize) }
|
||||
| --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:73:25
|
||||
::: $DIR/forbidden_slices.rs:74:25
|
||||
|
|
||||
LL | from_ptr_range(ptr..ptr.add(1))
|
||||
| ---------- inside `R8` at $DIR/forbidden_slices.rs:73:25
|
||||
| ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
@ -251,10 +251,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:78:34
|
||||
::: $DIR/forbidden_slices.rs:79:34
|
||||
|
|
||||
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
|
||||
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:78:34
|
||||
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
||||
@ -270,10 +270,10 @@ LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
|
||||
| ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
||||
|
|
||||
::: $DIR/forbidden_slices.rs:79:35
|
||||
::: $DIR/forbidden_slices.rs:80:35
|
||||
|
|
||||
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
|
||||
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:79:35
|
||||
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// stderr-per-bitwidth
|
||||
// normalize-stderr-test "alloc[0-9]+" -> "ALLOC_ID"
|
||||
// error-pattern: could not evaluate static initializer
|
||||
#![feature(
|
||||
const_slice_from_raw_parts,
|
||||
|
Loading…
Reference in New Issue
Block a user