More tests for large_enum_variant

This commit is contained in:
Samuel Tardieu 2024-12-15 23:21:47 +01:00
parent 60dbda209e
commit 76bc88c40f
3 changed files with 49 additions and 2 deletions

View file

@ -276,5 +276,21 @@ help: consider boxing the large fields to reduce the total size of the enum
LL | Error(Box<PossiblyLargeEnumWithConst<256>>),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 16 previous errors
error: large size difference between variants
--> tests/ui/large_enum_variant.rs:158:1
|
LL | / enum WithRecursion {
LL | | Large([u64; 64]),
| | ---------------- the largest variant contains at least 512 bytes
LL | | Recursive(Box<WithRecursion>),
| | ----------------------------- the second-largest variant contains at least 0 bytes
LL | | }
| |_^ the entire enum is at least 0 bytes
|
help: consider boxing the large fields to reduce the total size of the enum
|
LL | Large(Box<[u64; 64]>),
| ~~~~~~~~~~~~~~
error: aborting due to 17 previous errors

View file

@ -276,5 +276,21 @@ help: consider boxing the large fields to reduce the total size of the enum
LL | Error(Box<PossiblyLargeEnumWithConst<256>>),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 16 previous errors
error: large size difference between variants
--> tests/ui/large_enum_variant.rs:158:1
|
LL | / enum WithRecursion {
LL | | Large([u64; 64]),
| | ---------------- the largest variant contains at least 512 bytes
LL | | Recursive(Box<WithRecursion>),
| | ----------------------------- the second-largest variant contains at least 0 bytes
LL | | }
| |_^ the entire enum is at least 0 bytes
|
help: consider boxing the large fields to reduce the total size of the enum
|
LL | Large(Box<[u64; 64]>),
| ~~~~~~~~~~~~~~
error: aborting due to 17 previous errors

View file

@ -155,6 +155,21 @@ enum LargeEnumOfConst {
Error(PossiblyLargeEnumWithConst<256>),
}
enum WithRecursion {
Large([u64; 64]),
Recursive(Box<WithRecursion>),
}
enum WithRecursionAndGenerics<T> {
Large([T; 64]),
Recursive(Box<WithRecursionAndGenerics<T>>),
}
enum LargeEnumWithGenericsAndRecursive {
Ok(),
Error(WithRecursionAndGenerics<u64>),
}
fn main() {
external!(
enum LargeEnumInMacro {