]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/ub-enum.32bit.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / ub-enum.32bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2 --> $DIR/ub-enum.rs:24:1
3 |
4 LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
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: 4, align: 4) {
9 01 00 00 00 │ ....
10 }
11
12 error[E0080]: it is undefined behavior to use this value
13 --> $DIR/ub-enum.rs:27:1
14 |
15 LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered pointer to alloc9, but expected plain (non-pointer) bytes
17 |
18 = 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.
19 = note: the raw bytes of the constant (size: 4, align: 4) {
20 ╾─alloc9──╼ │ ╾──╼
21 }
22
23 error[E0080]: it is undefined behavior to use this value
24 --> $DIR/ub-enum.rs:30:1
25 |
26 LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0.<enum-tag>: encountered pointer to alloc13, but expected plain (non-pointer) bytes
28 |
29 = 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.
30 = note: the raw bytes of the constant (size: 4, align: 4) {
31 ╾─alloc13─╼ │ ╾──╼
32 }
33
34 error[E0080]: it is undefined behavior to use this value
35 --> $DIR/ub-enum.rs:42:1
36 |
37 LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
39 |
40 = 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.
41 = note: the raw bytes of the constant (size: 4, align: 4) {
42 00 00 00 00 │ ....
43 }
44
45 error[E0080]: it is undefined behavior to use this value
46 --> $DIR/ub-enum.rs:44:1
47 |
48 LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered pointer to alloc19, but expected plain (non-pointer) bytes
50 |
51 = 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.
52 = note: the raw bytes of the constant (size: 4, align: 4) {
53 ╾─alloc19─╼ │ ╾──╼
54 }
55
56 error[E0080]: it is undefined behavior to use this value
57 --> $DIR/ub-enum.rs:47:1
58 |
59 LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .0.<enum-tag>: encountered pointer to alloc23, but expected plain (non-pointer) bytes
61 |
62 = 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.
63 = note: the raw bytes of the constant (size: 4, align: 4) {
64 ╾─alloc23─╼ │ ╾──╼
65 }
66
67 error[E0080]: it is undefined behavior to use this value
68 --> $DIR/ub-enum.rs:56:1
69 |
70 LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
71 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes
72 |
73 = 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.
74 = note: the raw bytes of the constant (size: 4, align: 4) {
75 __ __ __ __ │ ░░░░
76 }
77
78 error[E0080]: it is undefined behavior to use this value
79 --> $DIR/ub-enum.rs:60:1
80 |
81 LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-tag>: encountered pointer to alloc30, but expected plain (non-pointer) bytes
83 |
84 = 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.
85 = note: the raw bytes of the constant (size: 4, align: 4) {
86 ╾─alloc30─╼ │ ╾──╼
87 }
88
89 error[E0080]: it is undefined behavior to use this value
90 --> $DIR/ub-enum.rs:77:1
91 |
92 LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(B)>.0: encountered a value of the never type `!`
94 |
95 = 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.
96 = note: the raw bytes of the constant (size: 1, align: 1) {
97 01 │ .
98 }
99
100 error[E0080]: it is undefined behavior to use this value
101 --> $DIR/ub-enum.rs:79:1
102 |
103 LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
105 |
106 = 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.
107 = note: the raw bytes of the constant (size: 1, align: 1) {
108 03 │ .
109 }
110
111 error[E0080]: it is undefined behavior to use this value
112 --> $DIR/ub-enum.rs:87:1
113 |
114 LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
115 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
116 |
117 = 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.
118 = note: the raw bytes of the constant (size: 8, align: 4) {
119 78 00 00 00 ff ff ff ff │ x.......
120 }
121
122 error[E0080]: evaluation of constant value failed
123 --> $DIR/ub-enum.rs:92:77
124 |
125 LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
126 | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
127
128 error[E0080]: evaluation of constant value failed
129 --> $DIR/ub-enum.rs:94:77
130 |
131 LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
132 | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
133
134 error: aborting due to 13 previous errors
135
136 For more information about this error, try `rustc --explain E0080`.