11error[E0080]: it is undefined behavior to use this value
2- --> $DIR/ub-enum.rs:23 :1
2+ --> $DIR/ub-enum.rs:24 :1
33 |
44LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
55 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
1010 }
1111
1212error: any use of this value will cause an error
13- --> $DIR/ub-enum.rs:26 :1
13+ --> $DIR/ub-enum.rs:27 :1
1414 |
1515LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
1616 | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -22,7 +22,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
2222 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
2323
2424error: any use of this value will cause an error
25- --> $DIR/ub-enum.rs:30 :1
25+ --> $DIR/ub-enum.rs:31 :1
2626 |
2727LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
2828 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -33,7 +33,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
3333 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
3434
3535error[E0080]: it is undefined behavior to use this value
36- --> $DIR/ub-enum.rs:43 :1
36+ --> $DIR/ub-enum.rs:44 :1
3737 |
3838LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
3939 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
@@ -44,7 +44,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
4444 }
4545
4646error: any use of this value will cause an error
47- --> $DIR/ub-enum.rs:45 :1
47+ --> $DIR/ub-enum.rs:46 :1
4848 |
4949LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
5050 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -55,7 +55,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
5555 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
5656
5757error: any use of this value will cause an error
58- --> $DIR/ub-enum.rs:49 :1
58+ --> $DIR/ub-enum.rs:50 :1
5959 |
6060LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
6161 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -66,13 +66,13 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
6666 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
6767
6868error[E0080]: evaluation of constant value failed
69- --> $DIR/ub-enum.rs:59 :42
69+ --> $DIR/ub-enum.rs:60 :42
7070 |
7171LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
7272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
7373
7474error: any use of this value will cause an error
75- --> $DIR/ub-enum.rs:64 :1
75+ --> $DIR/ub-enum.rs:65 :1
7676 |
7777LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
7878 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -83,7 +83,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
8383 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
8484
8585error[E0080]: it is undefined behavior to use this value
86- --> $DIR/ub-enum.rs:82 :1
86+ --> $DIR/ub-enum.rs:83 :1
8787 |
8888LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
8989 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
@@ -94,7 +94,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
9494 }
9595
9696error[E0080]: it is undefined behavior to use this value
97- --> $DIR/ub-enum.rs:84 :1
97+ --> $DIR/ub-enum.rs:85 :1
9898 |
9999LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
100100 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
@@ -105,7 +105,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
105105 }
106106
107107error[E0080]: it is undefined behavior to use this value
108- --> $DIR/ub-enum.rs:92 :1
108+ --> $DIR/ub-enum.rs:93 :1
109109 |
110110LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
111111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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`)
@@ -116,13 +116,13 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
116116 }
117117
118118error[E0080]: evaluation of constant value failed
119- --> $DIR/ub-enum.rs:97 :77
119+ --> $DIR/ub-enum.rs:98 :77
120120 |
121121LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
122122 | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
123123
124124error[E0080]: evaluation of constant value failed
125- --> $DIR/ub-enum.rs:99 :77
125+ --> $DIR/ub-enum.rs:100 :77
126126 |
127127LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
128128 | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
@@ -132,7 +132,7 @@ error: aborting due to 13 previous errors
132132For more information about this error, try `rustc --explain E0080`.
133133Future incompatibility report: Future breakage diagnostic:
134134error: any use of this value will cause an error
135- --> $DIR/ub-enum.rs:26 :1
135+ --> $DIR/ub-enum.rs:27 :1
136136 |
137137LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
138138 | ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -145,7 +145,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
145145
146146Future breakage diagnostic:
147147error: any use of this value will cause an error
148- --> $DIR/ub-enum.rs:30 :1
148+ --> $DIR/ub-enum.rs:31 :1
149149 |
150150LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
151151 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -158,7 +158,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
158158
159159Future breakage diagnostic:
160160error: any use of this value will cause an error
161- --> $DIR/ub-enum.rs:45 :1
161+ --> $DIR/ub-enum.rs:46 :1
162162 |
163163LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
164164 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -171,7 +171,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
171171
172172Future breakage diagnostic:
173173error: any use of this value will cause an error
174- --> $DIR/ub-enum.rs:49 :1
174+ --> $DIR/ub-enum.rs:50 :1
175175 |
176176LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
177177 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -184,7 +184,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
184184
185185Future breakage diagnostic:
186186error: any use of this value will cause an error
187- --> $DIR/ub-enum.rs:64 :1
187+ --> $DIR/ub-enum.rs:65 :1
188188 |
189189LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
190190 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
0 commit comments