fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0080]: it is undefined behavior to use this value 2 --> $DIR/ub-nonnull.rs:14:1 3 | 4LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) }; 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 6 | 7 = 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. 8 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { 9 HEX_DUMP 10 } 11 12error[E0080]: evaluation of constant value failed 13 --> $DIR/ub-nonnull.rs:20:30 14 | 15LL | let out_of_bounds_ptr = &ptr[255]; 16 | ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds 17 18error[E0080]: it is undefined behavior to use this value 19 --> $DIR/ub-nonnull.rs:24:1 20 | 21LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; 22 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 23 | 24 = 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. 25 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { 26 HEX_DUMP 27 } 28 29error[E0080]: it is undefined behavior to use this value 30 --> $DIR/ub-nonnull.rs:26:1 31 | 32LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; 33 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 34 | 35 = 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. 36 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { 37 HEX_DUMP 38 } 39 40error[E0080]: evaluation of constant value failed 41 --> $DIR/ub-nonnull.rs:34:36 42 | 43LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init }; 44 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory 45 46error[E0080]: it is undefined behavior to use this value 47 --> $DIR/ub-nonnull.rs:43:1 48 | 49LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; 50 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30 51 | 52 = 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. 53 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { 54 HEX_DUMP 55 } 56 57error[E0080]: it is undefined behavior to use this value 58 --> $DIR/ub-nonnull.rs:49:1 59 | 60LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; 61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30 62 | 63 = 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. 64 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { 65 HEX_DUMP 66 } 67 68error[E0080]: it is undefined behavior to use this value 69 --> $DIR/ub-nonnull.rs:52:1 70 | 71LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe { 72 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 73 | 74 = 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. 75 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { 76 HEX_DUMP 77 } 78 79error: aborting due to 8 previous errors 80 81For more information about this error, try `rustc --explain E0080`.