fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
9.9 KiB280 linesraw
1error: large size difference between variants
2  --> $DIR/large_enum_variant.rs:11:1
3   |
4LL | / enum LargeEnum {
5LL | |     A(i32),
6   | |     ------ the second-largest variant contains at least 4 bytes
7LL | |     B([i32; 8000]),
8   | |     -------------- the largest variant contains at least 32000 bytes
9LL | | }
10   | |_^ the entire enum is at least 32004 bytes
11   |
12   = note: `-D clippy::large-enum-variant` implied by `-D warnings`
13   = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]`
14help: consider boxing the large fields to reduce the total size of the enum
15   |
16LL |     B(Box<[i32; 8000]>),
17   |       ~~~~~~~~~~~~~~~~
18
19error: large size difference between variants
20  --> $DIR/large_enum_variant.rs:35:1
21   |
22LL | / enum LargeEnum2 {
23LL | |     VariantOk(i32, u32),
24   | |     ------------------- the second-largest variant contains at least 8 bytes
25LL | |     ContainingLargeEnum(LargeEnum),
26   | |     ------------------------------ the largest variant contains at least 32004 bytes
27LL | | }
28   | |_^ the entire enum is at least 32004 bytes
29   |
30help: consider boxing the large fields to reduce the total size of the enum
31   |
32LL |     ContainingLargeEnum(Box<LargeEnum>),
33   |                         ~~~~~~~~~~~~~~
34
35error: large size difference between variants
36  --> $DIR/large_enum_variant.rs:40:1
37   |
38LL | / enum LargeEnum3 {
39LL | |     ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]),
40   | |     --------------------------------------------------------- the largest variant contains at least 70004 bytes
41LL | |     VoidVariant,
42LL | |     StructLikeLittle { x: i32, y: i32 },
43   | |     ----------------------------------- the second-largest variant contains at least 8 bytes
44LL | | }
45   | |_^ the entire enum is at least 70008 bytes
46   |
47help: consider boxing the large fields to reduce the total size of the enum
48   |
49LL |     ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>),
50   |                                     ~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
51
52error: large size difference between variants
53  --> $DIR/large_enum_variant.rs:46:1
54   |
55LL | / enum LargeEnum4 {
56LL | |     VariantOk(i32, u32),
57   | |     ------------------- the second-largest variant contains at least 8 bytes
58LL | |     StructLikeLarge { x: [i32; 8000], y: i32 },
59   | |     ------------------------------------------ the largest variant contains at least 32004 bytes
60LL | | }
61   | |_^ the entire enum is at least 32008 bytes
62   |
63help: consider boxing the large fields to reduce the total size of the enum
64   |
65LL |     StructLikeLarge { x: Box<[i32; 8000]>, y: i32 },
66   |                          ~~~~~~~~~~~~~~~~
67
68error: large size difference between variants
69  --> $DIR/large_enum_variant.rs:51:1
70   |
71LL | / enum LargeEnum5 {
72LL | |     VariantOk(i32, u32),
73   | |     ------------------- the second-largest variant contains at least 8 bytes
74LL | |     StructLikeLarge2 { x: [i32; 8000] },
75   | |     ----------------------------------- the largest variant contains at least 32000 bytes
76LL | | }
77   | |_^ the entire enum is at least 32004 bytes
78   |
79help: consider boxing the large fields to reduce the total size of the enum
80   |
81LL |     StructLikeLarge2 { x: Box<[i32; 8000]> },
82   |                           ~~~~~~~~~~~~~~~~
83
84error: large size difference between variants
85  --> $DIR/large_enum_variant.rs:67:1
86   |
87LL | / enum LargeEnum7 {
88LL | |     A,
89LL | |     B([u8; 1255]),
90   | |     ------------- the largest variant contains at least 1255 bytes
91LL | |     C([u8; 200]),
92   | |     ------------ the second-largest variant contains at least 200 bytes
93LL | | }
94   | |_^ the entire enum is at least 1256 bytes
95   |
96help: consider boxing the large fields to reduce the total size of the enum
97   |
98LL |     B(Box<[u8; 1255]>),
99   |       ~~~~~~~~~~~~~~~
100
101error: large size difference between variants
102  --> $DIR/large_enum_variant.rs:73:1
103   |
104LL | / enum LargeEnum8 {
105LL | |     VariantOk(i32, u32),
106   | |     ------------------- the second-largest variant contains at least 8 bytes
107LL | |     ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]),
108   | |     ------------------------------------------------------------------------- the largest variant contains at least 70128 bytes
109LL | | }
110   | |_^ the entire enum is at least 70132 bytes
111   |
112help: consider boxing the large fields to reduce the total size of the enum
113   |
114LL |     ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]),
115   |                                ~~~~~~~~~~~~~~~~            ~~~~~~~~~~~~~~~~
116
117error: large size difference between variants
118  --> $DIR/large_enum_variant.rs:78:1
119   |
120LL | / enum LargeEnum9 {
121LL | |     A(Struct<()>),
122   | |     ------------- the second-largest variant contains at least 4 bytes
123LL | |     B(Struct2),
124   | |     ---------- the largest variant contains at least 32000 bytes
125LL | | }
126   | |_^ the entire enum is at least 32004 bytes
127   |
128help: consider boxing the large fields to reduce the total size of the enum
129   |
130LL |     B(Box<Struct2>),
131   |       ~~~~~~~~~~~~
132
133error: large size difference between variants
134  --> $DIR/large_enum_variant.rs:83:1
135   |
136LL | / enum LargeEnumOk2<T> {
137LL | |     A(T),
138   | |     ---- the second-largest variant contains at least 0 bytes
139LL | |     B(Struct2),
140   | |     ---------- the largest variant contains at least 32000 bytes
141LL | | }
142   | |_^ the entire enum is at least 32000 bytes
143   |
144help: consider boxing the large fields to reduce the total size of the enum
145   |
146LL |     B(Box<Struct2>),
147   |       ~~~~~~~~~~~~
148
149error: large size difference between variants
150  --> $DIR/large_enum_variant.rs:88:1
151   |
152LL | / enum LargeEnumOk3<T> {
153LL | |     A(Struct<T>),
154   | |     ------------ the second-largest variant contains at least 4 bytes
155LL | |     B(Struct2),
156   | |     ---------- the largest variant contains at least 32000 bytes
157LL | | }
158   | |_^ the entire enum is at least 32000 bytes
159   |
160help: consider boxing the large fields to reduce the total size of the enum
161   |
162LL |     B(Box<Struct2>),
163   |       ~~~~~~~~~~~~
164
165error: large size difference between variants
166  --> $DIR/large_enum_variant.rs:103:1
167   |
168LL | / enum CopyableLargeEnum {
169LL | |     A(bool),
170   | |     ------- the second-largest variant contains at least 1 bytes
171LL | |     B([u64; 8000]),
172   | |     -------------- the largest variant contains at least 64000 bytes
173LL | | }
174   | |_^ the entire enum is at least 64008 bytes
175   |
176note: boxing a variant would require the type no longer be `Copy`
177  --> $DIR/large_enum_variant.rs:103:6
178   |
179LL | enum CopyableLargeEnum {
180   |      ^^^^^^^^^^^^^^^^^
181help: consider boxing the large fields to reduce the total size of the enum
182  --> $DIR/large_enum_variant.rs:105:5
183   |
184LL |     B([u64; 8000]),
185   |     ^^^^^^^^^^^^^^
186
187error: large size difference between variants
188  --> $DIR/large_enum_variant.rs:108:1
189   |
190LL | / enum ManuallyCopyLargeEnum {
191LL | |     A(bool),
192   | |     ------- the second-largest variant contains at least 1 bytes
193LL | |     B([u64; 8000]),
194   | |     -------------- the largest variant contains at least 64000 bytes
195LL | | }
196   | |_^ the entire enum is at least 64008 bytes
197   |
198note: boxing a variant would require the type no longer be `Copy`
199  --> $DIR/large_enum_variant.rs:108:6
200   |
201LL | enum ManuallyCopyLargeEnum {
202   |      ^^^^^^^^^^^^^^^^^^^^^
203help: consider boxing the large fields to reduce the total size of the enum
204  --> $DIR/large_enum_variant.rs:110:5
205   |
206LL |     B([u64; 8000]),
207   |     ^^^^^^^^^^^^^^
208
209error: large size difference between variants
210  --> $DIR/large_enum_variant.rs:121:1
211   |
212LL | / enum SomeGenericPossiblyCopyEnum<T> {
213LL | |     A(bool, std::marker::PhantomData<T>),
214   | |     ------------------------------------ the second-largest variant contains at least 1 bytes
215LL | |     B([u64; 4000]),
216   | |     -------------- the largest variant contains at least 32000 bytes
217LL | | }
218   | |_^ the entire enum is at least 32008 bytes
219   |
220note: boxing a variant would require the type no longer be `Copy`
221  --> $DIR/large_enum_variant.rs:121:6
222   |
223LL | enum SomeGenericPossiblyCopyEnum<T> {
224   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
225help: consider boxing the large fields to reduce the total size of the enum
226  --> $DIR/large_enum_variant.rs:123:5
227   |
228LL |     B([u64; 4000]),
229   |     ^^^^^^^^^^^^^^
230
231error: large size difference between variants
232  --> $DIR/large_enum_variant.rs:134:1
233   |
234LL | / enum LargeEnumWithGenerics<T> {
235LL | |     Small,
236   | |     ----- the second-largest variant carries no data at all
237LL | |     Large((T, [u8; 512])),
238   | |     --------------------- the largest variant contains at least 512 bytes
239LL | | }
240   | |_^ the entire enum is at least 512 bytes
241   |
242help: consider boxing the large fields to reduce the total size of the enum
243   |
244LL |     Large(Box<(T, [u8; 512])>),
245   |           ~~~~~~~~~~~~~~~~~~~
246
247error: large size difference between variants
248  --> $DIR/large_enum_variant.rs:143:1
249   |
250LL | / enum WithGenerics {
251LL | |     Large([Foo<u64>; 64]),
252   | |     --------------------- the largest variant contains at least 512 bytes
253LL | |     Small(u8),
254   | |     --------- the second-largest variant contains at least 1 bytes
255LL | | }
256   | |_^ the entire enum is at least 520 bytes
257   |
258help: consider boxing the large fields to reduce the total size of the enum
259   |
260LL |     Large(Box<[Foo<u64>; 64]>),
261   |           ~~~~~~~~~~~~~~~~~~~
262
263error: large size difference between variants
264  --> $DIR/large_enum_variant.rs:153:1
265   |
266LL | / enum LargeEnumOfConst {
267LL | |     Ok,
268   | |     -- the second-largest variant carries no data at all
269LL | |     Error(PossiblyLargeEnumWithConst<256>),
270   | |     -------------------------------------- the largest variant contains at least 514 bytes
271LL | | }
272   | |_^ the entire enum is at least 514 bytes
273   |
274help: consider boxing the large fields to reduce the total size of the enum
275   |
276LL |     Error(Box<PossiblyLargeEnumWithConst<256>>),
277   |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278
279error: aborting due to 16 previous errors
280