From 2a8ce7c4588d3847ffe91fd90fcd8d0be2edb4df Mon Sep 17 00:00:00 2001 From: Owen Sanchez Date: Fri, 10 Feb 2017 21:04:19 -0700 Subject: [PATCH] Update large_enum_variant test --- tests/ui/large_enum_variant.rs | 29 ++++-------- tests/ui/large_enum_variant.stderr | 72 ++++++++++++------------------ 2 files changed, 37 insertions(+), 64 deletions(-) diff --git a/tests/ui/large_enum_variant.rs b/tests/ui/large_enum_variant.rs index 26ba883b1ba..8ac7571c1b1 100644 --- a/tests/ui/large_enum_variant.rs +++ b/tests/ui/large_enum_variant.rs @@ -7,9 +7,7 @@ enum LargeEnum { A(i32), - B([i32; 8000]), //~ ERROR large size difference between variants - //~^ HELP consider boxing the large fields to reduce the total size of the enum - //~| SUGGESTION Box<[i32; 8000]> + B([i32; 8000]), } enum GenericEnumOk { @@ -20,8 +18,7 @@ enum GenericEnumOk { enum GenericEnum2 { A(i32), B([i32; 8000]), - C(T, [i32; 8000]), //~ ERROR large size difference between variants - //~^ HELP consider boxing the large fields to reduce the total size of the enum + C(T, [i32; 8000]), } trait SomeTrait { @@ -29,35 +26,27 @@ trait SomeTrait { } enum LargeEnumGeneric { - Var(A::Item), // regression test, this used to ICE + Var(A::Item), } enum LargeEnum2 { VariantOk(i32, u32), - ContainingLargeEnum(LargeEnum), //~ ERROR large size difference between variants - //~^ HELP consider boxing the large fields to reduce the total size of the enum - //~| SUGGESTION Box + ContainingLargeEnum(LargeEnum), } enum LargeEnum3 { - ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), //~ ERROR large size difference between variants - //~^ HELP consider boxing the large fields to reduce the total size of the enum + ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), VoidVariant, StructLikeLittle { x: i32, y: i32 }, } enum LargeEnum4 { VariantOk(i32, u32), - StructLikeLarge { x: [i32; 8000], y: i32 }, //~ ERROR large size difference between variants - //~^ HELP consider boxing the large fields to reduce the total size of the enum + StructLikeLarge { x: [i32; 8000], y: i32 }, } enum LargeEnum5 { VariantOk(i32, u32), - StructLikeLarge2 { //~ ERROR large size difference between variants - x: - [i32; 8000] //~ SUGGESTION Box<[i32; 8000]> - //~^ HELP consider boxing the large fields to reduce the total size of the enum - }, + StructLikeLarge2 { x: [i32; 8000] }, } enum LargeEnumOk { @@ -65,6 +54,4 @@ enum LargeEnumOk { LargeB([i32; 8001]), } -fn main() { - -} +fn main() {} diff --git a/tests/ui/large_enum_variant.stderr b/tests/ui/large_enum_variant.stderr index 77155b6ab5f..84213003eb7 100644 --- a/tests/ui/large_enum_variant.stderr +++ b/tests/ui/large_enum_variant.stderr @@ -1,4 +1,4 @@ -error: large enum variant found +error: large size difference between variants --> $DIR/large_enum_variant.rs:10:5 | 10 | B([i32; 8000]), @@ -12,73 +12,59 @@ note: lint level defined here help: consider boxing the large fields to reduce the total size of the enum | B(Box<[i32; 8000]>), -error: large enum variant found - --> $DIR/large_enum_variant.rs:17:5 - | -17 | B([i32; 8000]), - | ^^^^^^^^^^^^^^ - | -help: consider boxing the large fields to reduce the total size of the enum - | B(Box<[i32; 8000]>), - -error: large enum variant found +error: large size difference between variants --> $DIR/large_enum_variant.rs:21:5 | -21 | D(T, [i32; 8000]), +21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum --> $DIR/large_enum_variant.rs:21:5 | -21 | D(T, [i32; 8000]), +21 | C(T, [i32; 8000]), | ^^^^^^^^^^^^^^^^^ -error: large enum variant found - --> $DIR/large_enum_variant.rs:35:5 +error: large size difference between variants + --> $DIR/large_enum_variant.rs:34:5 | -35 | ContainingLargeEnum(LargeEnum), +34 | ContainingLargeEnum(LargeEnum), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum | ContainingLargeEnum(Box), -error: large enum variant found - --> $DIR/large_enum_variant.rs:38:5 +error: large size difference between variants + --> $DIR/large_enum_variant.rs:37:5 | -38 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), +37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:38:5 + --> $DIR/large_enum_variant.rs:37:5 | -38 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), +37 | ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: large enum variant found - --> $DIR/large_enum_variant.rs:42:5 - | -42 | StructLikeLarge { x: [i32; 8000], y: i32 }, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: consider boxing the large fields to reduce the total size of the enum - --> $DIR/large_enum_variant.rs:42:5 - | -42 | StructLikeLarge { x: [i32; 8000], y: i32 }, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: large enum variant found +error: large size difference between variants --> $DIR/large_enum_variant.rs:44:5 | -44 | StructLikeLarge2 { - | _____^ starting here... -45 | | x: -46 | | [i32; 8000] -47 | | -48 | | }, - | |_____^ ...ending here +44 | StructLikeLarge { x: [i32; 8000], y: i32 }, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider boxing the large fields to reduce the total size of the enum - | Box<[i32; 8000]> + --> $DIR/large_enum_variant.rs:44:5 + | +44 | StructLikeLarge { x: [i32; 8000], y: i32 }, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error: large size difference between variants + --> $DIR/large_enum_variant.rs:49:5 + | +49 | StructLikeLarge2 { x: [i32; 8000] }, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: consider boxing the large fields to reduce the total size of the enum + | StructLikeLarge2 { x: Box<[i32; 8000]> }, + +error: aborting due to 6 previous errors