Skip to content

Commit 76bc88c

Browse files
committed
More tests for large_enum_variant
1 parent 60dbda2 commit 76bc88c

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

tests/ui/large_enum_variant.32bit.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,21 @@ help: consider boxing the large fields to reduce the total size of the enum
276276
LL | Error(Box<PossiblyLargeEnumWithConst<256>>),
277277
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278278

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
280296

tests/ui/large_enum_variant.64bit.stderr

+17-1
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,21 @@ help: consider boxing the large fields to reduce the total size of the enum
276276
LL | Error(Box<PossiblyLargeEnumWithConst<256>>),
277277
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278278

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
280296

tests/ui/large_enum_variant.rs

+15
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,21 @@ enum LargeEnumOfConst {
155155
Error(PossiblyLargeEnumWithConst<256>),
156156
}
157157

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+
158173
fn main() {
159174
external!(
160175
enum LargeEnumInMacro {

0 commit comments

Comments
 (0)