about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/large_enum_variant.32bit.stderr18
-rw-r--r--tests/ui/large_enum_variant.64bit.stderr18
-rw-r--r--tests/ui/large_enum_variant.rs15
3 files changed, 49 insertions, 2 deletions
diff --git a/tests/ui/large_enum_variant.32bit.stderr b/tests/ui/large_enum_variant.32bit.stderr
index ff4f1a7f312..7edff0df10f 100644
--- a/tests/ui/large_enum_variant.32bit.stderr
+++ b/tests/ui/large_enum_variant.32bit.stderr
@@ -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
 
diff --git a/tests/ui/large_enum_variant.64bit.stderr b/tests/ui/large_enum_variant.64bit.stderr
index 805cb406f83..a52967d962f 100644
--- a/tests/ui/large_enum_variant.64bit.stderr
+++ b/tests/ui/large_enum_variant.64bit.stderr
@@ -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
 
diff --git a/tests/ui/large_enum_variant.rs b/tests/ui/large_enum_variant.rs
index 3625c011dbf..fec4a1ee79f 100644
--- a/tests/ui/large_enum_variant.rs
+++ b/tests/ui/large_enum_variant.rs
@@ -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 {