2018-08-26 08:19:34 -05:00
error[E0080]: it is undefined behavior to use this value
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:27:1
2018-08-18 06:46:52 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag
2018-08-18 06:46:52 -05:00
|
2019-09-01 12:09:59 -05:00
= 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.
2022-12-22 09:40:50 -06:00
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
HEX_DUMP
2021-02-01 06:02:31 -06:00
}
2018-08-18 06:46:52 -05:00
2022-09-21 06:05:20 -05:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:30:1
2019-07-01 12:11:32 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2019-07-01 12:11:32 -05:00
|
2022-08-27 16:46:14 -05:00
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2019-07-01 12:11:32 -05:00
2022-09-21 06:05:20 -05:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:33:1
2019-07-01 12:11:32 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2019-07-01 12:11:32 -05:00
|
2022-08-27 16:46:14 -05:00
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2019-07-01 12:11:32 -05:00
error[E0080]: it is undefined behavior to use this value
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:45:1
2018-08-18 06:46:52 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
2018-08-18 06:46:52 -05:00
|
2019-09-01 12:09:59 -05:00
= 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.
2022-12-22 09:40:50 -06:00
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
HEX_DUMP
2021-02-01 06:02:31 -06:00
}
2018-08-18 06:46:52 -05:00
2022-09-21 06:05:20 -05:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:47:1
2018-11-01 08:41:36 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2018-11-01 08:41:36 -05:00
|
2022-08-27 16:46:14 -05:00
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2018-11-01 08:41:36 -05:00
2022-09-21 06:05:20 -05:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:50:1
2018-08-18 06:46:52 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2018-08-18 06:46:52 -05:00
|
2022-08-27 16:46:14 -05:00
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2018-08-18 06:46:52 -05:00
2022-08-01 18:05:20 -05:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:59:42
2018-11-03 06:44:10 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
2022-08-01 18:05:20 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
2018-11-03 06:44:10 -05:00
2022-09-21 06:05:20 -05:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:64:1
2018-11-12 04:22:18 -06:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
2018-11-12 04:22:18 -06:00
|
2022-08-27 16:46:14 -05:00
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2018-11-12 04:22:18 -06:00
error[E0080]: it is undefined behavior to use this value
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:81:1
2020-03-02 14:03:40 -06:00
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
2020-03-02 14:03:40 -06:00
|
= 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.
2022-12-22 09:40:50 -06:00
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
HEX_DUMP
2021-02-01 06:02:31 -06:00
}
2020-03-02 14:03:40 -06:00
error[E0080]: it is undefined behavior to use this value
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:83:1
2020-03-02 14:03:40 -06:00
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
2020-03-02 14:03:40 -06:00
|
= 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.
2022-12-22 09:40:50 -06:00
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
HEX_DUMP
2021-02-01 06:02:31 -06:00
}
2020-03-02 14:03:40 -06:00
error[E0080]: it is undefined behavior to use this value
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:91:1
2018-11-03 06:44:10 -05:00
|
2020-03-02 13:37:33 -06:00
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
2022-02-13 09:27:59 -06:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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`)
2018-11-03 06:44:10 -05:00
|
2019-09-01 12:09:59 -05:00
= 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.
2022-12-22 09:40:50 -06:00
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
HEX_DUMP
2021-02-01 06:02:31 -06:00
}
2018-11-03 06:44:10 -05:00
2022-01-24 18:00:00 -06:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:96:77
2020-03-02 14:03:40 -06:00
|
2020-07-03 05:12:50 -05:00
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
2022-01-24 18:00:00 -06:00
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
2020-03-02 14:03:40 -06:00
2022-01-24 18:00:00 -06:00
error[E0080]: evaluation of constant value failed
2022-12-22 09:40:50 -06:00
--> $DIR/ub-enum.rs:98:77
2020-03-02 14:03:40 -06:00
|
2020-07-03 05:12:50 -05:00
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
2022-01-24 18:00:00 -06:00
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
2020-03-02 14:03:40 -06:00
error: aborting due to 13 previous errors
2018-08-18 06:46:52 -05:00
For more information about this error, try `rustc --explain E0080`.