]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / ub-nonnull.64bit.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
cdc7bbd5 2 --> $DIR/ub-nonnull.rs:12:1
0bf4aa26
XL
3 |
4LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
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.
cdc7bbd5
XL
8 = note: the raw bytes of the constant (size: 8, align: 8) {
9 00 00 00 00 00 00 00 00 │ ........
10 }
0bf4aa26 11
136023e0 12error[E0080]: evaluation of constant value failed
cdc7bbd5 13 --> $DIR/ub-nonnull.rs:19: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
136023e0 19 --> $DIR/ub-nonnull.rs:23:1
0bf4aa26
XL
20 |
21LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
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.
cdc7bbd5
XL
25 = note: the raw bytes of the constant (size: 1, align: 1) {
26 00 │ .
27 }
0bf4aa26 28
a1dfa0c6 29error[E0080]: it is undefined behavior to use this value
136023e0 30 --> $DIR/ub-nonnull.rs:25:1
0bf4aa26
XL
31 |
32LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
33 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1
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.
cdc7bbd5
XL
36 = note: the raw bytes of the constant (size: 8, align: 8) {
37 00 00 00 00 00 00 00 00 │ ........
38 }
0bf4aa26 39
a1dfa0c6 40error[E0080]: it is undefined behavior to use this value
136023e0 41 --> $DIR/ub-nonnull.rs:33:1
9fa01778 42 |
74b04a01 43LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
136023e0 44 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
9fa01778 45 |
e1599b0c 46 = 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.
cdc7bbd5
XL
47 = note: the raw bytes of the constant (size: 1, align: 1) {
48 __ │ ░
49 }
9fa01778
XL
50
51error[E0080]: it is undefined behavior to use this value
136023e0 52 --> $DIR/ub-nonnull.rs:41:1
a1dfa0c6
XL
53 |
54LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 10..=30
56 |
e1599b0c 57 = 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.
cdc7bbd5
XL
58 = note: the raw bytes of the constant (size: 4, align: 4) {
59 2a 00 00 00 │ *...
60 }
a1dfa0c6
XL
61
62error[E0080]: it is undefined behavior to use this value
136023e0 63 --> $DIR/ub-nonnull.rs:47:1
a1dfa0c6
XL
64 |
65LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
66 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 20, but expected something less or equal to 10, or greater or equal to 30
67 |
e1599b0c 68 = 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.
cdc7bbd5
XL
69 = note: the raw bytes of the constant (size: 4, align: 4) {
70 14 00 00 00 │ ....
71 }
a1dfa0c6 72
416331ca 73error: aborting due to 7 previous errors
0bf4aa26
XL
74
75For more information about this error, try `rustc --explain E0080`.