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