mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
223 lines
11 KiB
Plaintext
223 lines
11 KiB
Plaintext
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:16:1
|
|
|
|
|
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:18:1
|
|
|
|
|
LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
|
|
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:22:1
|
|
|
|
|
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:26:1
|
|
|
|
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
|
|
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:28:1
|
|
|
|
|
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:30:1
|
|
|
|
|
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:33:1
|
|
|
|
|
LL | pub static S7: &[u16] = unsafe {
|
|
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:41:1
|
|
|
|
|
LL | pub static S8: &[u64] = unsafe {
|
|
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:48:1
|
|
|
|
|
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: could not evaluate static initializer
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
|
= 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
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const ()>::sub_ptr`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
note: inside `from_ptr_range::<'_, ()>`
|
|
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
|
note: inside `R1`
|
|
--> $DIR/forbidden_slices.rs:50:33
|
|
|
|
|
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error[E0080]: could not evaluate static initializer
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
|
= note: out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC10 which is only 4 bytes from the end of the allocation
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u32>::add`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
note: inside `R2`
|
|
--> $DIR/forbidden_slices.rs:53:25
|
|
|
|
|
LL | from_ptr_range(ptr..ptr.add(2)) // errors inside libcore
|
|
| ^^^^^^^^^^
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:55:1
|
|
|
|
|
LL | pub static R4: &[u8] = unsafe {
|
|
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:60:1
|
|
|
|
|
LL | pub static R5: &[u8] = unsafe {
|
|
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
|
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:65:1
|
|
|
|
|
LL | pub static R6: &[bool] = unsafe {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/forbidden_slices.rs:70:1
|
|
|
|
|
LL | pub static R7: &[u16] = unsafe {
|
|
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
|
|
|
|
|
= 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: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: could not evaluate static initializer
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
|
= note: out-of-bounds pointer arithmetic: expected a pointer to 8 bytes of memory, but got ALLOC11+0x1 which is only 7 bytes from the end of the allocation
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u64>::add`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
note: inside `R8`
|
|
--> $DIR/forbidden_slices.rs:77:25
|
|
|
|
|
LL | from_ptr_range(ptr..ptr.add(1))
|
|
| ^^^^^^^^^^
|
|
|
|
error[E0080]: could not evaluate static initializer
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
|
= note: `ptr_offset_from_unsigned` called on pointers into different allocations
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u32>::sub_ptr`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
note: inside `from_ptr_range::<'_, u32>`
|
|
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
|
note: inside `R9`
|
|
--> $DIR/forbidden_slices.rs:82:34
|
|
|
|
|
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error[E0080]: could not evaluate static initializer
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
|
|
|
= note: `ptr_offset_from_unsigned` called on pointers into different allocations
|
|
|
|
|
note: inside `std::ptr::const_ptr::<impl *const u32>::sub_ptr`
|
|
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
|
note: inside `from_ptr_range::<'_, u32>`
|
|
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
|
|
note: inside `R10`
|
|
--> $DIR/forbidden_slices.rs:83:35
|
|
|
|
|
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 18 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0080`.
|