]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr
New upstream version 1.66.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) };
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.
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
2b03887a 13 --> $DIR/ub-nonnull.rs:18: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
2b03887a 19 --> $DIR/ub-nonnull.rs:22: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.
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
2b03887a 30 --> $DIR/ub-nonnull.rs:24: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.
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
f2b60f7d 40error[E0080]: evaluation of constant value failed
2b03887a 41 --> $DIR/ub-nonnull.rs:32: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
2b03887a 47 --> $DIR/ub-nonnull.rs:41: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.
cdc7bbd5
XL
53 = note: the raw bytes of the constant (size: 4, align: 4) {
54 2a 00 00 00 │ *...
55 }
a1dfa0c6
XL
56
57error[E0080]: it is undefined behavior to use this value
2b03887a 58 --> $DIR/ub-nonnull.rs:47: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.
cdc7bbd5
XL
64 = note: the raw bytes of the constant (size: 4, align: 4) {
65 14 00 00 00 │ ....
66 }
a1dfa0c6 67
416331ca 68error: aborting due to 7 previous errors
0bf4aa26
XL
69
70For more information about this error, try `rustc --explain E0080`.