File tree 3 files changed +49
-2
lines changed
3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -276,5 +276,21 @@ help: consider boxing the large fields to reduce the total size of the enum
276
276
LL | Error(Box<PossiblyLargeEnumWithConst<256>>),
277
277
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278
278
279
- error: aborting due to 16 previous errors
279
+ error: large size difference between variants
280
+ --> tests/ui/large_enum_variant.rs:158:1
281
+ |
282
+ LL | / enum WithRecursion {
283
+ LL | | Large([u64; 64]),
284
+ | | ---------------- the largest variant contains at least 512 bytes
285
+ LL | | Recursive(Box<WithRecursion>),
286
+ | | ----------------------------- the second-largest variant contains at least 0 bytes
287
+ LL | | }
288
+ | |_^ the entire enum is at least 0 bytes
289
+ |
290
+ help: consider boxing the large fields to reduce the total size of the enum
291
+ |
292
+ LL | Large(Box<[u64; 64]>),
293
+ | ~~~~~~~~~~~~~~
294
+
295
+ error: aborting due to 17 previous errors
280
296
Original file line number Diff line number Diff line change @@ -276,5 +276,21 @@ help: consider boxing the large fields to reduce the total size of the enum
276
276
LL | Error(Box<PossiblyLargeEnumWithConst<256>>),
277
277
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278
278
279
- error: aborting due to 16 previous errors
279
+ error: large size difference between variants
280
+ --> tests/ui/large_enum_variant.rs:158:1
281
+ |
282
+ LL | / enum WithRecursion {
283
+ LL | | Large([u64; 64]),
284
+ | | ---------------- the largest variant contains at least 512 bytes
285
+ LL | | Recursive(Box<WithRecursion>),
286
+ | | ----------------------------- the second-largest variant contains at least 0 bytes
287
+ LL | | }
288
+ | |_^ the entire enum is at least 0 bytes
289
+ |
290
+ help: consider boxing the large fields to reduce the total size of the enum
291
+ |
292
+ LL | Large(Box<[u64; 64]>),
293
+ | ~~~~~~~~~~~~~~
294
+
295
+ error: aborting due to 17 previous errors
280
296
Original file line number Diff line number Diff line change @@ -155,6 +155,21 @@ enum LargeEnumOfConst {
155
155
Error ( PossiblyLargeEnumWithConst < 256 > ) ,
156
156
}
157
157
158
+ enum WithRecursion {
159
+ Large ( [ u64 ; 64 ] ) ,
160
+ Recursive ( Box < WithRecursion > ) ,
161
+ }
162
+
163
+ enum WithRecursionAndGenerics < T > {
164
+ Large ( [ T ; 64 ] ) ,
165
+ Recursive ( Box < WithRecursionAndGenerics < T > > ) ,
166
+ }
167
+
168
+ enum LargeEnumWithGenericsAndRecursive {
169
+ Ok ( ) ,
170
+ Error ( WithRecursionAndGenerics < u64 > ) ,
171
+ }
172
+
158
173
fn main ( ) {
159
174
external ! (
160
175
enum LargeEnumInMacro {
You can’t perform that action at this time.
0 commit comments