Update large_enum_variant test

This commit is contained in:
Owen Sanchez 2017-02-10 21:04:19 -07:00
parent 45a7012fd9
commit 2a8ce7c458
2 changed files with 37 additions and 64 deletions

View File

@ -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<T> {
@ -20,8 +18,7 @@ enum GenericEnumOk<T> {
enum GenericEnum2<T> {
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<A: SomeTrait> {
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<LargeEnum>
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() {}

View File

@ -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<LargeEnum>),
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