]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-enum.64bit.stderr
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / ub-enum.64bit.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
064997fb 2 --> $DIR/ub-enum.rs:23:1
8faf50e0 3 |
74b04a01 4LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
064997fb 5 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag
8faf50e0 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 01 00 00 00 00 00 00 00 │ ........
10 }
8faf50e0 11
064997fb
FG
12error: any use of this value will cause an error
13 --> $DIR/ub-enum.rs:26:1
416331ca 14 |
74b04a01 15LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
064997fb 16 | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
416331ca 17 |
064997fb
FG
18 = note: `#[deny(const_err)]` on by default
19 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
20 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
21 = help: this code performed an operation that depends on the underlying bytes representing a pointer
22 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
416331ca 23
064997fb 24error: any use of this value will cause an error
f9f354fc 25 --> $DIR/ub-enum.rs:30:1
416331ca 26 |
74b04a01 27LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
064997fb 28 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
416331ca 29 |
064997fb
FG
30 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
31 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
32 = help: this code performed an operation that depends on the underlying bytes representing a pointer
33 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
416331ca
XL
34
35error[E0080]: it is undefined behavior to use this value
064997fb 36 --> $DIR/ub-enum.rs:43:1
8faf50e0 37 |
74b04a01 38LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
064997fb 39 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
8faf50e0 40 |
e1599b0c 41 = 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
42 = note: the raw bytes of the constant (size: 8, align: 8) {
43 00 00 00 00 00 00 00 00 │ ........
44 }
8faf50e0 45
064997fb
FG
46error: any use of this value will cause an error
47 --> $DIR/ub-enum.rs:45:1
8faf50e0 48 |
74b04a01 49LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
064997fb 50 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
8faf50e0 51 |
064997fb
FG
52 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
53 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
54 = help: this code performed an operation that depends on the underlying bytes representing a pointer
55 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
8faf50e0 56
064997fb
FG
57error: any use of this value will cause an error
58 --> $DIR/ub-enum.rs:49:1
a1dfa0c6 59 |
74b04a01 60LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
064997fb 61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
a1dfa0c6 62 |
064997fb
FG
63 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
64 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
65 = help: this code performed an operation that depends on the underlying bytes representing a pointer
66 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
a1dfa0c6
XL
67
68error[E0080]: it is undefined behavior to use this value
064997fb 69 --> $DIR/ub-enum.rs:59:1
a1dfa0c6 70 |
74b04a01 71LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
064997fb 72 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered uninitialized bytes, but expected initialized bytes
a1dfa0c6 73 |
e1599b0c 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.
cdc7bbd5
XL
75 = note: the raw bytes of the constant (size: 8, align: 8) {
76 __ __ __ __ __ __ __ __ │ ░░░░░░░░
77 }
a1dfa0c6 78
064997fb
FG
79error: any use of this value will cause an error
80 --> $DIR/ub-enum.rs:63:1
a1dfa0c6 81 |
74b04a01 82LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
064997fb 83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
a1dfa0c6 84 |
064997fb
FG
85 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
86 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
87 = help: this code performed an operation that depends on the underlying bytes representing a pointer
88 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
a1dfa0c6
XL
89
90error[E0080]: it is undefined behavior to use this value
064997fb 91 --> $DIR/ub-enum.rs:81:1
a1dfa0c6 92 |
74b04a01 93LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
064997fb 94 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
a1dfa0c6 95 |
e1599b0c 96 = 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
97 = note: the raw bytes of the constant (size: 1, align: 1) {
98 01 │ .
99 }
a1dfa0c6 100
74b04a01 101error[E0080]: it is undefined behavior to use this value
064997fb 102 --> $DIR/ub-enum.rs:83:1
74b04a01
XL
103 |
104LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
064997fb 105 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
74b04a01
XL
106 |
107 = 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
108 = note: the raw bytes of the constant (size: 1, align: 1) {
109 03 │ .
110 }
74b04a01
XL
111
112error[E0080]: it is undefined behavior to use this value
064997fb 113 --> $DIR/ub-enum.rs:91:1
74b04a01
XL
114 |
115LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
064997fb 116 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
74b04a01
XL
117 |
118 = 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
119 = note: the raw bytes of the constant (size: 8, align: 4) {
120 78 00 00 00 ff ff ff ff │ x.......
121 }
74b04a01 122
04454e1e 123error[E0080]: evaluation of constant value failed
064997fb 124 --> $DIR/ub-enum.rs:96:77
74b04a01 125 |
f035d41b 126LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
04454e1e 127 | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
74b04a01 128
04454e1e 129error[E0080]: evaluation of constant value failed
064997fb 130 --> $DIR/ub-enum.rs:98:77
74b04a01 131 |
f035d41b 132LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
04454e1e 133 | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
74b04a01
XL
134
135error: aborting due to 13 previous errors
8faf50e0
XL
136
137For more information about this error, try `rustc --explain E0080`.
064997fb
FG
138Future incompatibility report: Future breakage diagnostic:
139error: any use of this value will cause an error
140 --> $DIR/ub-enum.rs:26:1
141 |
142LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
143 | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
144 |
145 = note: `#[deny(const_err)]` on by default
146 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
147 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
148 = help: this code performed an operation that depends on the underlying bytes representing a pointer
149 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
150
151Future breakage diagnostic:
152error: any use of this value will cause an error
153 --> $DIR/ub-enum.rs:30:1
154 |
155LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
156 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
157 |
158 = note: `#[deny(const_err)]` on by default
159 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
160 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
161 = help: this code performed an operation that depends on the underlying bytes representing a pointer
162 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
163
164Future breakage diagnostic:
165error: any use of this value will cause an error
166 --> $DIR/ub-enum.rs:45:1
167 |
168LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
169 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
170 |
171 = note: `#[deny(const_err)]` on by default
172 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
173 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
174 = help: this code performed an operation that depends on the underlying bytes representing a pointer
175 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
176
177Future breakage diagnostic:
178error: any use of this value will cause an error
179 --> $DIR/ub-enum.rs:49:1
180 |
181LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
182 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
183 |
184 = note: `#[deny(const_err)]` on by default
185 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
186 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
187 = help: this code performed an operation that depends on the underlying bytes representing a pointer
188 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
189
190Future breakage diagnostic:
191error: any use of this value will cause an error
192 --> $DIR/ub-enum.rs:63:1
193 |
194LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
195 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
196 |
197 = note: `#[deny(const_err)]` on by default
198 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
199 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
200 = help: this code performed an operation that depends on the underlying bytes representing a pointer
201 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
202