This commit is contained in:
Maybe Waffle 2022-05-29 13:43:01 +04:00
parent 0cca47ea1a
commit 6d10217382

View File

@ -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:15:34
::: $DIR/forbidden_slices.rs:16:34
|
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:15:34
| ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:16: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:16:33
::: $DIR/forbidden_slices.rs:17:33
|
LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:16:33
| ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:17:33
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
@ -35,13 +35,13 @@ 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
| inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
::: $DIR/forbidden_slices.rs:19:34
::: $DIR/forbidden_slices.rs:20:34
|
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:19:34
| ---------------------- inside `S2` at $DIR/forbidden_slices.rs:20:34
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:22:1
--> $DIR/forbidden_slices.rs:23:1
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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) }
}
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 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
@ -63,7 +63,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size
}
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 S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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)
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:29:1
--> $DIR/forbidden_slices.rs:30:1
|
LL | / pub static S7: &[u16] = unsafe {
LL | |
@ -98,10 +98,10 @@ 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
| inside `std::slice::from_raw_parts::<u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
::: $DIR/forbidden_slices.rs:40:5
::: $DIR/forbidden_slices.rs:41:5
|
LL | from_raw_parts(ptr, 1)
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:40:5
| ---------------------- inside `S8` at $DIR/forbidden_slices.rs:41: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:43:34
::: $DIR/forbidden_slices.rs:44:34
|
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:43:34
| ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:44: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:44:33
::: $DIR/forbidden_slices.rs:45:33
|
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:44:33
| ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:45:33
|
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -155,13 +155,13 @@ LL | unsafe { intrinsics::offset(self, count) }
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:47:25
::: $DIR/forbidden_slices.rs:48:25
|
LL | from_ptr_range(ptr..ptr.add(2))
| ---------- inside `R2` at $DIR/forbidden_slices.rs:47:25
| ---------- inside `R2` at $DIR/forbidden_slices.rs:48:25
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:49:1
--> $DIR/forbidden_slices.rs:50:1
|
LL | / pub static R4: &[u8] = unsafe {
LL | |
@ -176,7 +176,7 @@ LL | | };
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:54:1
--> $DIR/forbidden_slices.rs:55:1
|
LL | / pub static R5: &[u8] = unsafe {
LL | |
@ -191,7 +191,7 @@ LL | | };
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:59:1
--> $DIR/forbidden_slices.rs:60:1
|
LL | / pub static R6: &[bool] = unsafe {
LL | |
@ -206,7 +206,7 @@ LL | | };
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:64:1
--> $DIR/forbidden_slices.rs:65:1
|
LL | / pub static R7: &[u16] = unsafe {
LL | |
@ -232,10 +232,10 @@ LL | unsafe { intrinsics::offset(self, count) }
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:71:25
::: $DIR/forbidden_slices.rs:72:25
|
LL | from_ptr_range(ptr..ptr.add(1))
| ---------- inside `R8` at $DIR/forbidden_slices.rs:71:25
| ---------- inside `R8` at $DIR/forbidden_slices.rs:72: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:76:34
::: $DIR/forbidden_slices.rs:77:34
|
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:76:34
| ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:77: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:77:35
::: $DIR/forbidden_slices.rs:78:35
|
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:77:35
| ------------------------ inside `R10` at $DIR/forbidden_slices.rs:78:35
error: aborting due to 18 previous errors