| error[E0080]: constructing invalid value: encountered 0, but expected something greater or equal to 1 |
| --> $DIR/ub-nonnull.rs:16:1 |
| | |
| LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value |
| | |
| = 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]: in-bounds pointer arithmetic failed: attempting to offset pointer by 255 bytes, but got ALLOC1 which is only 1 byte from the end of the allocation |
| --> $DIR/ub-nonnull.rs:22:29 |
| | |
| LL | let out_of_bounds_ptr = &ptr[255]; |
| | ^^^^^^^^^ evaluation of `OUT_OF_BOUNDS_PTR` failed here |
| |
| error[E0080]: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 |
| --> $DIR/ub-nonnull.rs:26:1 |
| | |
| LL | const NULL_U8: NonZero<u8> = unsafe { mem::transmute(0u8) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value |
| | |
| = 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]: constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 |
| --> $DIR/ub-nonnull.rs:28:1 |
| | |
| LL | const NULL_USIZE: NonZero<usize> = unsafe { mem::transmute(0usize) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value |
| | |
| = 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]: reading memory at ALLOC2[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory |
| --> $DIR/ub-nonnull.rs:36:38 |
| | |
| LL | const UNINIT: NonZero<u8> = unsafe { MaybeUninit { uninit: () }.init }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `UNINIT` failed here |
| | |
| = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { |
| __ │ ░ |
| } |
| |
| error[E0080]: constructing invalid value: encountered 42, but expected something in the range 10..=30 |
| --> $DIR/ub-nonnull.rs:44:1 |
| | |
| LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value |
| | |
| = 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]: constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 |
| --> $DIR/ub-nonnull.rs:50:1 |
| | |
| LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value |
| | |
| = 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]: constructing invalid value: encountered 0, but expected something greater or equal to 1 |
| --> $DIR/ub-nonnull.rs:53:1 |
| | |
| LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe { |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value |
| | |
| = 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: aborting due to 8 previous errors |
| |
| For more information about this error, try `rustc --explain E0080`. |