1
1
error[E0080]: it is undefined behavior to use this value
2
- --> $DIR/ub-enum.rs:23 :1
2
+ --> $DIR/ub-enum.rs:24 :1
3
3
|
4
4
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
5
5
| ^^^^^^^^^^^^^^^^^^^^ 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) };
10
10
}
11
11
12
12
error: any use of this value will cause an error
13
- --> $DIR/ub-enum.rs:26 :1
13
+ --> $DIR/ub-enum.rs:27 :1
14
14
|
15
15
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
16
16
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -22,7 +22,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
22
22
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
23
23
24
24
error: any use of this value will cause an error
25
- --> $DIR/ub-enum.rs:30 :1
25
+ --> $DIR/ub-enum.rs:31 :1
26
26
|
27
27
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
28
28
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -33,7 +33,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
33
33
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
34
34
35
35
error[E0080]: it is undefined behavior to use this value
36
- --> $DIR/ub-enum.rs:43 :1
36
+ --> $DIR/ub-enum.rs:44 :1
37
37
|
38
38
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
39
39
| ^^^^^^^^^^^^^^^^^^^^^^ 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) };
44
44
}
45
45
46
46
error: any use of this value will cause an error
47
- --> $DIR/ub-enum.rs:45 :1
47
+ --> $DIR/ub-enum.rs:46 :1
48
48
|
49
49
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
50
50
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -55,7 +55,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
55
55
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
56
56
57
57
error: any use of this value will cause an error
58
- --> $DIR/ub-enum.rs:49 :1
58
+ --> $DIR/ub-enum.rs:50 :1
59
59
|
60
60
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
61
61
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -66,13 +66,13 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
66
66
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
67
67
68
68
error[E0080]: evaluation of constant value failed
69
- --> $DIR/ub-enum.rs:59 :42
69
+ --> $DIR/ub-enum.rs:60 :42
70
70
|
71
71
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
72
72
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
73
73
74
74
error: any use of this value will cause an error
75
- --> $DIR/ub-enum.rs:64 :1
75
+ --> $DIR/ub-enum.rs:65 :1
76
76
|
77
77
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
78
78
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -83,7 +83,7 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
83
83
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
84
84
85
85
error[E0080]: it is undefined behavior to use this value
86
- --> $DIR/ub-enum.rs:82 :1
86
+ --> $DIR/ub-enum.rs:83 :1
87
87
|
88
88
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
89
89
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
94
94
}
95
95
96
96
error[E0080]: it is undefined behavior to use this value
97
- --> $DIR/ub-enum.rs:84 :1
97
+ --> $DIR/ub-enum.rs:85 :1
98
98
|
99
99
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
100
100
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
105
105
}
106
106
107
107
error[E0080]: it is undefined behavior to use this value
108
- --> $DIR/ub-enum.rs:92 :1
108
+ --> $DIR/ub-enum.rs:93 :1
109
109
|
110
110
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
111
111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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
116
116
}
117
117
118
118
error[E0080]: evaluation of constant value failed
119
- --> $DIR/ub-enum.rs:97 :77
119
+ --> $DIR/ub-enum.rs:98 :77
120
120
|
121
121
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
122
122
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
123
123
124
124
error[E0080]: evaluation of constant value failed
125
- --> $DIR/ub-enum.rs:99 :77
125
+ --> $DIR/ub-enum.rs:100 :77
126
126
|
127
127
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
128
128
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
@@ -132,7 +132,7 @@ error: aborting due to 13 previous errors
132
132
For more information about this error, try `rustc --explain E0080`.
133
133
Future incompatibility report: Future breakage diagnostic:
134
134
error: any use of this value will cause an error
135
- --> $DIR/ub-enum.rs:26 :1
135
+ --> $DIR/ub-enum.rs:27 :1
136
136
|
137
137
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
138
138
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -145,7 +145,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
145
145
146
146
Future breakage diagnostic:
147
147
error: any use of this value will cause an error
148
- --> $DIR/ub-enum.rs:30 :1
148
+ --> $DIR/ub-enum.rs:31 :1
149
149
|
150
150
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
151
151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -158,7 +158,7 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
158
158
159
159
Future breakage diagnostic:
160
160
error: any use of this value will cause an error
161
- --> $DIR/ub-enum.rs:45 :1
161
+ --> $DIR/ub-enum.rs:46 :1
162
162
|
163
163
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
164
164
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -171,7 +171,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
171
171
172
172
Future breakage diagnostic:
173
173
error: any use of this value will cause an error
174
- --> $DIR/ub-enum.rs:49 :1
174
+ --> $DIR/ub-enum.rs:50 :1
175
175
|
176
176
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
177
177
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -184,7 +184,7 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
184
184
185
185
Future breakage diagnostic:
186
186
error: any use of this value will cause an error
187
- --> $DIR/ub-enum.rs:64 :1
187
+ --> $DIR/ub-enum.rs:65 :1
188
188
|
189
189
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
190
190
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
0 commit comments