]> git.proxmox.com Git - rustc.git/blame - tests/ui/consts/const-eval/ub-nonnull.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / consts / const-eval / ub-nonnull.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
f25598a0 2 --> $DIR/ub-nonnull.rs:14:1
0bf4aa26
XL
3 |
4LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
064997fb 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
0bf4aa26 6 |
e1599b0c 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.
f25598a0
FG
8 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
9 HEX_DUMP
cdc7bbd5 10 }
0bf4aa26 11
136023e0 12error[E0080]: evaluation of constant value failed
f25598a0 13 --> $DIR/ub-nonnull.rs:20:30
416331ca 14 |
136023e0
XL
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
416331ca
XL
17
18error[E0080]: it is undefined behavior to use this value
f25598a0 19 --> $DIR/ub-nonnull.rs:24:1
0bf4aa26
XL
20 |
21LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
064997fb 22 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
0bf4aa26 23 |
e1599b0c 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.
f25598a0
FG
25 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
26 HEX_DUMP
cdc7bbd5 27 }
0bf4aa26 28
a1dfa0c6 29error[E0080]: it is undefined behavior to use this value
f25598a0 30 --> $DIR/ub-nonnull.rs:26:1
0bf4aa26
XL
31 |
32LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
064997fb 33 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
0bf4aa26 34 |
e1599b0c 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.
f25598a0
FG
36 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
37 HEX_DUMP
cdc7bbd5 38 }
0bf4aa26 39
f2b60f7d 40error[E0080]: evaluation of constant value failed
f25598a0 41 --> $DIR/ub-nonnull.rs:34:36
9fa01778 42 |
74b04a01 43LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
f2b60f7d 44 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
9fa01778
XL
45
46error[E0080]: it is undefined behavior to use this value
f25598a0 47 --> $DIR/ub-nonnull.rs:43:1
a1dfa0c6
XL
48 |
49LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
064997fb 50 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
a1dfa0c6 51 |
e1599b0c 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.
f25598a0
FG
53 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
54 HEX_DUMP
cdc7bbd5 55 }
a1dfa0c6
XL
56
57error[E0080]: it is undefined behavior to use this value
f25598a0 58 --> $DIR/ub-nonnull.rs:49:1
a1dfa0c6
XL
59 |
60LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
064997fb 61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
a1dfa0c6 62 |
e1599b0c 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.
f25598a0
FG
64 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
65 HEX_DUMP
cdc7bbd5 66 }
a1dfa0c6 67
487cf647 68error[E0080]: it is undefined behavior to use this value
f25598a0 69 --> $DIR/ub-nonnull.rs:52:1
487cf647
FG
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.
f25598a0
FG
75 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
76 HEX_DUMP
487cf647
FG
77 }
78
79error: aborting due to 8 previous errors
0bf4aa26
XL
80
81For more information about this error, try `rustc --explain E0080`.