]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deriving/deriving-all-codegen.stdout
Rollup merge of #100040 - ChrisDenton:broken-pipe, r=davidtwco
[rust.git] / src / test / ui / deriving / deriving-all-codegen.stdout
1 #![feature(prelude_import)]
2 // check-pass
3 // compile-flags: -Zunpretty=expanded
4 // edition:2021
5 //
6 // This test checks the code generated for all[*] the builtin derivable traits
7 // on a variety of structs and enums. It protects against accidental changes to
8 // the generated code, and makes deliberate changes to the generated code
9 // easier to review.
10 //
11 // [*] It excludes `Copy` in some cases, because that changes the code
12 // generated for `Clone`.
13 //
14 // [*] It excludes `RustcEncodable` and `RustDecodable`, which are obsolete and
15 // also require the `rustc_serialize` crate.
16
17 #![crate_type = "lib"]
18 #![allow(dead_code)]
19 #![allow(deprecated)]
20 #[prelude_import]
21 use std::prelude::rust_2021::*;
22 #[macro_use]
23 extern crate std;
24
25 // Empty struct.
26 struct Empty;
27 #[automatically_derived]
28 impl ::core::clone::Clone for Empty {
29     #[inline]
30     fn clone(&self) -> Empty { *self }
31 }
32 #[automatically_derived]
33 impl ::core::marker::Copy for Empty { }
34 #[automatically_derived]
35 impl ::core::fmt::Debug for Empty {
36     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
37         ::core::fmt::Formatter::write_str(f, "Empty")
38     }
39 }
40 #[automatically_derived]
41 impl ::core::default::Default for Empty {
42     #[inline]
43     fn default() -> Empty { Empty {} }
44 }
45 #[automatically_derived]
46 impl ::core::hash::Hash for Empty {
47     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {}
48 }
49 impl ::core::marker::StructuralPartialEq for Empty {}
50 #[automatically_derived]
51 impl ::core::cmp::PartialEq for Empty {
52     #[inline]
53     fn eq(&self, other: &Empty) -> bool { true }
54 }
55 impl ::core::marker::StructuralEq for Empty {}
56 #[automatically_derived]
57 impl ::core::cmp::Eq for Empty {
58     #[inline]
59     #[doc(hidden)]
60     #[no_coverage]
61     fn assert_receiver_is_total_eq(&self) -> () {}
62 }
63 #[automatically_derived]
64 impl ::core::cmp::PartialOrd for Empty {
65     #[inline]
66     fn partial_cmp(&self, other: &Empty)
67         -> ::core::option::Option<::core::cmp::Ordering> {
68         ::core::option::Option::Some(::core::cmp::Ordering::Equal)
69     }
70 }
71 #[automatically_derived]
72 impl ::core::cmp::Ord for Empty {
73     #[inline]
74     fn cmp(&self, other: &Empty) -> ::core::cmp::Ordering {
75         ::core::cmp::Ordering::Equal
76     }
77 }
78
79 // A basic struct.
80 struct Point {
81     x: u32,
82     y: u32,
83 }
84 #[automatically_derived]
85 impl ::core::clone::Clone for Point {
86     #[inline]
87     fn clone(&self) -> Point {
88         let _: ::core::clone::AssertParamIsClone<u32>;
89         *self
90     }
91 }
92 #[automatically_derived]
93 impl ::core::marker::Copy for Point { }
94 #[automatically_derived]
95 impl ::core::fmt::Debug for Point {
96     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
97         ::core::fmt::Formatter::debug_struct_field2_finish(f, "Point", "x",
98             &&self.x, "y", &&self.y)
99     }
100 }
101 #[automatically_derived]
102 impl ::core::default::Default for Point {
103     #[inline]
104     fn default() -> Point {
105         Point {
106             x: ::core::default::Default::default(),
107             y: ::core::default::Default::default(),
108         }
109     }
110 }
111 #[automatically_derived]
112 impl ::core::hash::Hash for Point {
113     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
114         ::core::hash::Hash::hash(&self.x, state);
115         ::core::hash::Hash::hash(&self.y, state)
116     }
117 }
118 impl ::core::marker::StructuralPartialEq for Point {}
119 #[automatically_derived]
120 impl ::core::cmp::PartialEq for Point {
121     #[inline]
122     fn eq(&self, other: &Point) -> bool {
123         self.x == other.x && self.y == other.y
124     }
125     #[inline]
126     fn ne(&self, other: &Point) -> bool {
127         self.x != other.x || self.y != other.y
128     }
129 }
130 impl ::core::marker::StructuralEq for Point {}
131 #[automatically_derived]
132 impl ::core::cmp::Eq for Point {
133     #[inline]
134     #[doc(hidden)]
135     #[no_coverage]
136     fn assert_receiver_is_total_eq(&self) -> () {
137         let _: ::core::cmp::AssertParamIsEq<u32>;
138     }
139 }
140 #[automatically_derived]
141 impl ::core::cmp::PartialOrd for Point {
142     #[inline]
143     fn partial_cmp(&self, other: &Point)
144         -> ::core::option::Option<::core::cmp::Ordering> {
145         match ::core::cmp::PartialOrd::partial_cmp(&self.x, &other.x) {
146             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
147                 ::core::cmp::PartialOrd::partial_cmp(&self.y, &other.y),
148             cmp => cmp,
149         }
150     }
151 }
152 #[automatically_derived]
153 impl ::core::cmp::Ord for Point {
154     #[inline]
155     fn cmp(&self, other: &Point) -> ::core::cmp::Ordering {
156         match ::core::cmp::Ord::cmp(&self.x, &other.x) {
157             ::core::cmp::Ordering::Equal =>
158                 ::core::cmp::Ord::cmp(&self.y, &other.y),
159             cmp => cmp,
160         }
161     }
162 }
163
164 // A large struct.
165 struct Big {
166     b1: u32,
167     b2: u32,
168     b3: u32,
169     b4: u32,
170     b5: u32,
171     b6: u32,
172     b7: u32,
173     b8: u32,
174 }
175 #[automatically_derived]
176 impl ::core::clone::Clone for Big {
177     #[inline]
178     fn clone(&self) -> Big {
179         Big {
180             b1: ::core::clone::Clone::clone(&self.b1),
181             b2: ::core::clone::Clone::clone(&self.b2),
182             b3: ::core::clone::Clone::clone(&self.b3),
183             b4: ::core::clone::Clone::clone(&self.b4),
184             b5: ::core::clone::Clone::clone(&self.b5),
185             b6: ::core::clone::Clone::clone(&self.b6),
186             b7: ::core::clone::Clone::clone(&self.b7),
187             b8: ::core::clone::Clone::clone(&self.b8),
188         }
189     }
190 }
191 #[automatically_derived]
192 impl ::core::fmt::Debug for Big {
193     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
194         let names: &'static _ =
195             &["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"];
196         let values: &[&dyn ::core::fmt::Debug] =
197             &[&&self.b1, &&self.b2, &&self.b3, &&self.b4, &&self.b5,
198                         &&self.b6, &&self.b7, &&self.b8];
199         ::core::fmt::Formatter::debug_struct_fields_finish(f, "Big", names,
200             values)
201     }
202 }
203 #[automatically_derived]
204 impl ::core::default::Default for Big {
205     #[inline]
206     fn default() -> Big {
207         Big {
208             b1: ::core::default::Default::default(),
209             b2: ::core::default::Default::default(),
210             b3: ::core::default::Default::default(),
211             b4: ::core::default::Default::default(),
212             b5: ::core::default::Default::default(),
213             b6: ::core::default::Default::default(),
214             b7: ::core::default::Default::default(),
215             b8: ::core::default::Default::default(),
216         }
217     }
218 }
219 #[automatically_derived]
220 impl ::core::hash::Hash for Big {
221     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
222         ::core::hash::Hash::hash(&self.b1, state);
223         ::core::hash::Hash::hash(&self.b2, state);
224         ::core::hash::Hash::hash(&self.b3, state);
225         ::core::hash::Hash::hash(&self.b4, state);
226         ::core::hash::Hash::hash(&self.b5, state);
227         ::core::hash::Hash::hash(&self.b6, state);
228         ::core::hash::Hash::hash(&self.b7, state);
229         ::core::hash::Hash::hash(&self.b8, state)
230     }
231 }
232 impl ::core::marker::StructuralPartialEq for Big {}
233 #[automatically_derived]
234 impl ::core::cmp::PartialEq for Big {
235     #[inline]
236     fn eq(&self, other: &Big) -> bool {
237         self.b1 == other.b1 && self.b2 == other.b2 && self.b3 == other.b3 &&
238                             self.b4 == other.b4 && self.b5 == other.b5 &&
239                     self.b6 == other.b6 && self.b7 == other.b7 &&
240             self.b8 == other.b8
241     }
242     #[inline]
243     fn ne(&self, other: &Big) -> bool {
244         self.b1 != other.b1 || self.b2 != other.b2 || self.b3 != other.b3 ||
245                             self.b4 != other.b4 || self.b5 != other.b5 ||
246                     self.b6 != other.b6 || self.b7 != other.b7 ||
247             self.b8 != other.b8
248     }
249 }
250 impl ::core::marker::StructuralEq for Big {}
251 #[automatically_derived]
252 impl ::core::cmp::Eq for Big {
253     #[inline]
254     #[doc(hidden)]
255     #[no_coverage]
256     fn assert_receiver_is_total_eq(&self) -> () {
257         let _: ::core::cmp::AssertParamIsEq<u32>;
258     }
259 }
260 #[automatically_derived]
261 impl ::core::cmp::PartialOrd for Big {
262     #[inline]
263     fn partial_cmp(&self, other: &Big)
264         -> ::core::option::Option<::core::cmp::Ordering> {
265         match ::core::cmp::PartialOrd::partial_cmp(&self.b1, &other.b1) {
266             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
267                 match ::core::cmp::PartialOrd::partial_cmp(&self.b2,
268                         &other.b2) {
269                     ::core::option::Option::Some(::core::cmp::Ordering::Equal)
270                         =>
271                         match ::core::cmp::PartialOrd::partial_cmp(&self.b3,
272                                 &other.b3) {
273                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
274                                 =>
275                                 match ::core::cmp::PartialOrd::partial_cmp(&self.b4,
276                                         &other.b4) {
277                                     ::core::option::Option::Some(::core::cmp::Ordering::Equal)
278                                         =>
279                                         match ::core::cmp::PartialOrd::partial_cmp(&self.b5,
280                                                 &other.b5) {
281                                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
282                                                 =>
283                                                 match ::core::cmp::PartialOrd::partial_cmp(&self.b6,
284                                                         &other.b6) {
285                                                     ::core::option::Option::Some(::core::cmp::Ordering::Equal)
286                                                         =>
287                                                         match ::core::cmp::PartialOrd::partial_cmp(&self.b7,
288                                                                 &other.b7) {
289                                                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
290                                                                 =>
291                                                                 ::core::cmp::PartialOrd::partial_cmp(&self.b8, &other.b8),
292                                                             cmp => cmp,
293                                                         },
294                                                     cmp => cmp,
295                                                 },
296                                             cmp => cmp,
297                                         },
298                                     cmp => cmp,
299                                 },
300                             cmp => cmp,
301                         },
302                     cmp => cmp,
303                 },
304             cmp => cmp,
305         }
306     }
307 }
308 #[automatically_derived]
309 impl ::core::cmp::Ord for Big {
310     #[inline]
311     fn cmp(&self, other: &Big) -> ::core::cmp::Ordering {
312         match ::core::cmp::Ord::cmp(&self.b1, &other.b1) {
313             ::core::cmp::Ordering::Equal =>
314                 match ::core::cmp::Ord::cmp(&self.b2, &other.b2) {
315                     ::core::cmp::Ordering::Equal =>
316                         match ::core::cmp::Ord::cmp(&self.b3, &other.b3) {
317                             ::core::cmp::Ordering::Equal =>
318                                 match ::core::cmp::Ord::cmp(&self.b4, &other.b4) {
319                                     ::core::cmp::Ordering::Equal =>
320                                         match ::core::cmp::Ord::cmp(&self.b5, &other.b5) {
321                                             ::core::cmp::Ordering::Equal =>
322                                                 match ::core::cmp::Ord::cmp(&self.b6, &other.b6) {
323                                                     ::core::cmp::Ordering::Equal =>
324                                                         match ::core::cmp::Ord::cmp(&self.b7, &other.b7) {
325                                                             ::core::cmp::Ordering::Equal =>
326                                                                 ::core::cmp::Ord::cmp(&self.b8, &other.b8),
327                                                             cmp => cmp,
328                                                         },
329                                                     cmp => cmp,
330                                                 },
331                                             cmp => cmp,
332                                         },
333                                     cmp => cmp,
334                                 },
335                             cmp => cmp,
336                         },
337                     cmp => cmp,
338                 },
339             cmp => cmp,
340         }
341     }
342 }
343
344 // A struct with an unsized field. Some derives are not usable in this case.
345 struct Unsized([u32]);
346 #[automatically_derived]
347 impl ::core::fmt::Debug for Unsized {
348     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
349         ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Unsized",
350             &&self.0)
351     }
352 }
353 #[automatically_derived]
354 impl ::core::hash::Hash for Unsized {
355     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
356         ::core::hash::Hash::hash(&self.0, state)
357     }
358 }
359 impl ::core::marker::StructuralPartialEq for Unsized {}
360 #[automatically_derived]
361 impl ::core::cmp::PartialEq for Unsized {
362     #[inline]
363     fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 }
364     #[inline]
365     fn ne(&self, other: &Unsized) -> bool { self.0 != other.0 }
366 }
367 impl ::core::marker::StructuralEq for Unsized {}
368 #[automatically_derived]
369 impl ::core::cmp::Eq for Unsized {
370     #[inline]
371     #[doc(hidden)]
372     #[no_coverage]
373     fn assert_receiver_is_total_eq(&self) -> () {
374         let _: ::core::cmp::AssertParamIsEq<[u32]>;
375     }
376 }
377 #[automatically_derived]
378 impl ::core::cmp::PartialOrd for Unsized {
379     #[inline]
380     fn partial_cmp(&self, other: &Unsized)
381         -> ::core::option::Option<::core::cmp::Ordering> {
382         ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
383     }
384 }
385 #[automatically_derived]
386 impl ::core::cmp::Ord for Unsized {
387     #[inline]
388     fn cmp(&self, other: &Unsized) -> ::core::cmp::Ordering {
389         ::core::cmp::Ord::cmp(&self.0, &other.0)
390     }
391 }
392
393 // A packed tuple struct that impls `Copy`.
394 #[repr(packed)]
395 struct PackedCopy(u32);
396 #[automatically_derived]
397 impl ::core::clone::Clone for PackedCopy {
398     #[inline]
399     fn clone(&self) -> PackedCopy {
400         let _: ::core::clone::AssertParamIsClone<u32>;
401         *self
402     }
403 }
404 #[automatically_derived]
405 impl ::core::marker::Copy for PackedCopy { }
406 #[automatically_derived]
407 impl ::core::fmt::Debug for PackedCopy {
408     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
409         ::core::fmt::Formatter::debug_tuple_field1_finish(f, "PackedCopy",
410             &&{ self.0 })
411     }
412 }
413 #[automatically_derived]
414 impl ::core::default::Default for PackedCopy {
415     #[inline]
416     fn default() -> PackedCopy {
417         PackedCopy(::core::default::Default::default())
418     }
419 }
420 #[automatically_derived]
421 impl ::core::hash::Hash for PackedCopy {
422     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
423         ::core::hash::Hash::hash(&{ self.0 }, state)
424     }
425 }
426 impl ::core::marker::StructuralPartialEq for PackedCopy {}
427 #[automatically_derived]
428 impl ::core::cmp::PartialEq for PackedCopy {
429     #[inline]
430     fn eq(&self, other: &PackedCopy) -> bool { { self.0 } == { other.0 } }
431     #[inline]
432     fn ne(&self, other: &PackedCopy) -> bool { { self.0 } != { other.0 } }
433 }
434 impl ::core::marker::StructuralEq for PackedCopy {}
435 #[automatically_derived]
436 impl ::core::cmp::Eq for PackedCopy {
437     #[inline]
438     #[doc(hidden)]
439     #[no_coverage]
440     fn assert_receiver_is_total_eq(&self) -> () {
441         let _: ::core::cmp::AssertParamIsEq<u32>;
442     }
443 }
444 #[automatically_derived]
445 impl ::core::cmp::PartialOrd for PackedCopy {
446     #[inline]
447     fn partial_cmp(&self, other: &PackedCopy)
448         -> ::core::option::Option<::core::cmp::Ordering> {
449         ::core::cmp::PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
450     }
451 }
452 #[automatically_derived]
453 impl ::core::cmp::Ord for PackedCopy {
454     #[inline]
455     fn cmp(&self, other: &PackedCopy) -> ::core::cmp::Ordering {
456         ::core::cmp::Ord::cmp(&{ self.0 }, &{ other.0 })
457     }
458 }
459
460 // A packed tuple struct that does not impl `Copy`. Note that the alignment of
461 // the field must be 1 for this code to be valid. Otherwise it triggers an
462 // error "`#[derive]` can't be used on a `#[repr(packed)]` struct that does not
463 // derive Copy (error E0133)" at MIR building time. This is a weird case and
464 // it's possible that this struct is not supposed to work, but for now it does.
465 #[repr(packed)]
466 struct PackedNonCopy(u8);
467 #[automatically_derived]
468 impl ::core::clone::Clone for PackedNonCopy {
469     #[inline]
470     fn clone(&self) -> PackedNonCopy {
471         let Self(ref __self_0_0) = *self;
472         PackedNonCopy(::core::clone::Clone::clone(__self_0_0))
473     }
474 }
475 #[automatically_derived]
476 impl ::core::fmt::Debug for PackedNonCopy {
477     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
478         let Self(ref __self_0_0) = *self;
479         ::core::fmt::Formatter::debug_tuple_field1_finish(f, "PackedNonCopy",
480             &__self_0_0)
481     }
482 }
483 #[automatically_derived]
484 impl ::core::default::Default for PackedNonCopy {
485     #[inline]
486     fn default() -> PackedNonCopy {
487         PackedNonCopy(::core::default::Default::default())
488     }
489 }
490 #[automatically_derived]
491 impl ::core::hash::Hash for PackedNonCopy {
492     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
493         let Self(ref __self_0_0) = *self;
494         ::core::hash::Hash::hash(__self_0_0, state)
495     }
496 }
497 impl ::core::marker::StructuralPartialEq for PackedNonCopy {}
498 #[automatically_derived]
499 impl ::core::cmp::PartialEq for PackedNonCopy {
500     #[inline]
501     fn eq(&self, other: &PackedNonCopy) -> bool {
502         let Self(ref __self_0_0) = *self;
503         let Self(ref __self_1_0) = *other;
504         *__self_0_0 == *__self_1_0
505     }
506     #[inline]
507     fn ne(&self, other: &PackedNonCopy) -> bool {
508         let Self(ref __self_0_0) = *self;
509         let Self(ref __self_1_0) = *other;
510         *__self_0_0 != *__self_1_0
511     }
512 }
513 impl ::core::marker::StructuralEq for PackedNonCopy {}
514 #[automatically_derived]
515 impl ::core::cmp::Eq for PackedNonCopy {
516     #[inline]
517     #[doc(hidden)]
518     #[no_coverage]
519     fn assert_receiver_is_total_eq(&self) -> () {
520         let _: ::core::cmp::AssertParamIsEq<u8>;
521     }
522 }
523 #[automatically_derived]
524 impl ::core::cmp::PartialOrd for PackedNonCopy {
525     #[inline]
526     fn partial_cmp(&self, other: &PackedNonCopy)
527         -> ::core::option::Option<::core::cmp::Ordering> {
528         let Self(ref __self_0_0) = *self;
529         let Self(ref __self_1_0) = *other;
530         ::core::cmp::PartialOrd::partial_cmp(__self_0_0, __self_1_0)
531     }
532 }
533 #[automatically_derived]
534 impl ::core::cmp::Ord for PackedNonCopy {
535     #[inline]
536     fn cmp(&self, other: &PackedNonCopy) -> ::core::cmp::Ordering {
537         let Self(ref __self_0_0) = *self;
538         let Self(ref __self_1_0) = *other;
539         ::core::cmp::Ord::cmp(__self_0_0, __self_1_0)
540     }
541 }
542
543 // An empty enum.
544 enum Enum0 {}
545 #[automatically_derived]
546 impl ::core::clone::Clone for Enum0 {
547     #[inline]
548     fn clone(&self) -> Enum0 { *self }
549 }
550 #[automatically_derived]
551 impl ::core::marker::Copy for Enum0 { }
552 #[automatically_derived]
553 impl ::core::fmt::Debug for Enum0 {
554     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
555         unsafe { ::core::intrinsics::unreachable() }
556     }
557 }
558 #[automatically_derived]
559 impl ::core::hash::Hash for Enum0 {
560     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
561         unsafe { ::core::intrinsics::unreachable() }
562     }
563 }
564 impl ::core::marker::StructuralPartialEq for Enum0 {}
565 #[automatically_derived]
566 impl ::core::cmp::PartialEq for Enum0 {
567     #[inline]
568     fn eq(&self, other: &Enum0) -> bool {
569         unsafe { ::core::intrinsics::unreachable() }
570     }
571 }
572 impl ::core::marker::StructuralEq for Enum0 {}
573 #[automatically_derived]
574 impl ::core::cmp::Eq for Enum0 {
575     #[inline]
576     #[doc(hidden)]
577     #[no_coverage]
578     fn assert_receiver_is_total_eq(&self) -> () {}
579 }
580 #[automatically_derived]
581 impl ::core::cmp::PartialOrd for Enum0 {
582     #[inline]
583     fn partial_cmp(&self, other: &Enum0)
584         -> ::core::option::Option<::core::cmp::Ordering> {
585         unsafe { ::core::intrinsics::unreachable() }
586     }
587 }
588 #[automatically_derived]
589 impl ::core::cmp::Ord for Enum0 {
590     #[inline]
591     fn cmp(&self, other: &Enum0) -> ::core::cmp::Ordering {
592         unsafe { ::core::intrinsics::unreachable() }
593     }
594 }
595
596 // A single-variant enum.
597 enum Enum1 {
598     Single {
599         x: u32,
600     },
601 }
602 #[automatically_derived]
603 impl ::core::clone::Clone for Enum1 {
604     #[inline]
605     fn clone(&self) -> Enum1 {
606         match self {
607             Enum1::Single { x: __self_0 } =>
608                 Enum1::Single { x: ::core::clone::Clone::clone(__self_0) },
609         }
610     }
611 }
612 #[automatically_derived]
613 impl ::core::fmt::Debug for Enum1 {
614     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
615         match self {
616             Enum1::Single { x: __self_0 } =>
617                 ::core::fmt::Formatter::debug_struct_field1_finish(f,
618                     "Single", "x", &__self_0),
619         }
620     }
621 }
622 #[automatically_derived]
623 impl ::core::hash::Hash for Enum1 {
624     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
625         match self {
626             Enum1::Single { x: __self_0 } =>
627                 ::core::hash::Hash::hash(__self_0, state),
628         }
629     }
630 }
631 impl ::core::marker::StructuralPartialEq for Enum1 {}
632 #[automatically_derived]
633 impl ::core::cmp::PartialEq for Enum1 {
634     #[inline]
635     fn eq(&self, other: &Enum1) -> bool {
636         match (self, other) {
637             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
638                 *__self_0 == *__arg1_0,
639         }
640     }
641     #[inline]
642     fn ne(&self, other: &Enum1) -> bool {
643         match (self, other) {
644             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
645                 *__self_0 != *__arg1_0,
646         }
647     }
648 }
649 impl ::core::marker::StructuralEq for Enum1 {}
650 #[automatically_derived]
651 impl ::core::cmp::Eq for Enum1 {
652     #[inline]
653     #[doc(hidden)]
654     #[no_coverage]
655     fn assert_receiver_is_total_eq(&self) -> () {
656         let _: ::core::cmp::AssertParamIsEq<u32>;
657     }
658 }
659 #[automatically_derived]
660 impl ::core::cmp::PartialOrd for Enum1 {
661     #[inline]
662     fn partial_cmp(&self, other: &Enum1)
663         -> ::core::option::Option<::core::cmp::Ordering> {
664         match (self, other) {
665             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
666                 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
667         }
668     }
669 }
670 #[automatically_derived]
671 impl ::core::cmp::Ord for Enum1 {
672     #[inline]
673     fn cmp(&self, other: &Enum1) -> ::core::cmp::Ordering {
674         match (self, other) {
675             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
676                 ::core::cmp::Ord::cmp(__self_0, __arg1_0),
677         }
678     }
679 }
680
681 // A C-like, fieldless enum with a single variant.
682 enum Fieldless1 {
683
684     #[default]
685     A,
686 }
687 #[automatically_derived]
688 impl ::core::clone::Clone for Fieldless1 {
689     #[inline]
690     fn clone(&self) -> Fieldless1 { Fieldless1::A }
691 }
692 #[automatically_derived]
693 impl ::core::fmt::Debug for Fieldless1 {
694     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
695         ::core::fmt::Formatter::write_str(f, "A")
696     }
697 }
698 #[automatically_derived]
699 impl ::core::default::Default for Fieldless1 {
700     #[inline]
701     fn default() -> Fieldless1 { Self::A }
702 }
703 #[automatically_derived]
704 impl ::core::hash::Hash for Fieldless1 {
705     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {}
706 }
707 impl ::core::marker::StructuralPartialEq for Fieldless1 {}
708 #[automatically_derived]
709 impl ::core::cmp::PartialEq for Fieldless1 {
710     #[inline]
711     fn eq(&self, other: &Fieldless1) -> bool { true }
712 }
713 impl ::core::marker::StructuralEq for Fieldless1 {}
714 #[automatically_derived]
715 impl ::core::cmp::Eq for Fieldless1 {
716     #[inline]
717     #[doc(hidden)]
718     #[no_coverage]
719     fn assert_receiver_is_total_eq(&self) -> () {}
720 }
721 #[automatically_derived]
722 impl ::core::cmp::PartialOrd for Fieldless1 {
723     #[inline]
724     fn partial_cmp(&self, other: &Fieldless1)
725         -> ::core::option::Option<::core::cmp::Ordering> {
726         ::core::option::Option::Some(::core::cmp::Ordering::Equal)
727     }
728 }
729 #[automatically_derived]
730 impl ::core::cmp::Ord for Fieldless1 {
731     #[inline]
732     fn cmp(&self, other: &Fieldless1) -> ::core::cmp::Ordering {
733         ::core::cmp::Ordering::Equal
734     }
735 }
736
737 // A C-like, fieldless enum.
738 enum Fieldless {
739
740     #[default]
741     A,
742     B,
743     C,
744 }
745 #[automatically_derived]
746 impl ::core::clone::Clone for Fieldless {
747     #[inline]
748     fn clone(&self) -> Fieldless { *self }
749 }
750 #[automatically_derived]
751 impl ::core::marker::Copy for Fieldless { }
752 #[automatically_derived]
753 impl ::core::fmt::Debug for Fieldless {
754     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
755         match self {
756             Fieldless::A => ::core::fmt::Formatter::write_str(f, "A"),
757             Fieldless::B => ::core::fmt::Formatter::write_str(f, "B"),
758             Fieldless::C => ::core::fmt::Formatter::write_str(f, "C"),
759         }
760     }
761 }
762 #[automatically_derived]
763 impl ::core::default::Default for Fieldless {
764     #[inline]
765     fn default() -> Fieldless { Self::A }
766 }
767 #[automatically_derived]
768 impl ::core::hash::Hash for Fieldless {
769     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
770         let __self_tag = ::core::intrinsics::discriminant_value(self);
771         ::core::hash::Hash::hash(&__self_tag, state)
772     }
773 }
774 impl ::core::marker::StructuralPartialEq for Fieldless {}
775 #[automatically_derived]
776 impl ::core::cmp::PartialEq for Fieldless {
777     #[inline]
778     fn eq(&self, other: &Fieldless) -> bool {
779         let __self_tag = ::core::intrinsics::discriminant_value(self);
780         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
781         __self_tag == __arg1_tag
782     }
783 }
784 impl ::core::marker::StructuralEq for Fieldless {}
785 #[automatically_derived]
786 impl ::core::cmp::Eq for Fieldless {
787     #[inline]
788     #[doc(hidden)]
789     #[no_coverage]
790     fn assert_receiver_is_total_eq(&self) -> () {}
791 }
792 #[automatically_derived]
793 impl ::core::cmp::PartialOrd for Fieldless {
794     #[inline]
795     fn partial_cmp(&self, other: &Fieldless)
796         -> ::core::option::Option<::core::cmp::Ordering> {
797         let __self_tag = ::core::intrinsics::discriminant_value(self);
798         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
799         ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag)
800     }
801 }
802 #[automatically_derived]
803 impl ::core::cmp::Ord for Fieldless {
804     #[inline]
805     fn cmp(&self, other: &Fieldless) -> ::core::cmp::Ordering {
806         let __self_tag = ::core::intrinsics::discriminant_value(self);
807         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
808         ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag)
809     }
810 }
811
812 // An enum with multiple fieldless and fielded variants.
813 enum Mixed {
814
815     #[default]
816     P,
817     Q,
818     R(u32),
819     S {
820         d1: u32,
821         d2: u32,
822     },
823 }
824 #[automatically_derived]
825 impl ::core::clone::Clone for Mixed {
826     #[inline]
827     fn clone(&self) -> Mixed {
828         let _: ::core::clone::AssertParamIsClone<u32>;
829         *self
830     }
831 }
832 #[automatically_derived]
833 impl ::core::marker::Copy for Mixed { }
834 #[automatically_derived]
835 impl ::core::fmt::Debug for Mixed {
836     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
837         match self {
838             Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
839             Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"),
840             Mixed::R(__self_0) =>
841                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R",
842                     &__self_0),
843             Mixed::S { d1: __self_0, d2: __self_1 } =>
844                 ::core::fmt::Formatter::debug_struct_field2_finish(f, "S",
845                     "d1", &__self_0, "d2", &__self_1),
846         }
847     }
848 }
849 #[automatically_derived]
850 impl ::core::default::Default for Mixed {
851     #[inline]
852     fn default() -> Mixed { Self::P }
853 }
854 #[automatically_derived]
855 impl ::core::hash::Hash for Mixed {
856     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
857         let __self_tag = ::core::intrinsics::discriminant_value(self);
858         ::core::hash::Hash::hash(&__self_tag, state);
859         match self {
860             Mixed::R(__self_0) => ::core::hash::Hash::hash(__self_0, state),
861             Mixed::S { d1: __self_0, d2: __self_1 } => {
862                 ::core::hash::Hash::hash(__self_0, state);
863                 ::core::hash::Hash::hash(__self_1, state)
864             }
865             _ => {}
866         }
867     }
868 }
869 impl ::core::marker::StructuralPartialEq for Mixed {}
870 #[automatically_derived]
871 impl ::core::cmp::PartialEq for Mixed {
872     #[inline]
873     fn eq(&self, other: &Mixed) -> bool {
874         let __self_tag = ::core::intrinsics::discriminant_value(self);
875         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
876         __self_tag == __arg1_tag &&
877             match (self, other) {
878                 (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
879                     *__self_0 == *__arg1_0,
880                 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
881                     d1: __arg1_0, d2: __arg1_1 }) =>
882                     *__self_0 == *__arg1_0 && *__self_1 == *__arg1_1,
883                 _ => true,
884             }
885     }
886     #[inline]
887     fn ne(&self, other: &Mixed) -> bool {
888         let __self_tag = ::core::intrinsics::discriminant_value(self);
889         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
890         __self_tag != __arg1_tag ||
891             match (self, other) {
892                 (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
893                     *__self_0 != *__arg1_0,
894                 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
895                     d1: __arg1_0, d2: __arg1_1 }) =>
896                     *__self_0 != *__arg1_0 || *__self_1 != *__arg1_1,
897                 _ => false,
898             }
899     }
900 }
901 impl ::core::marker::StructuralEq for Mixed {}
902 #[automatically_derived]
903 impl ::core::cmp::Eq for Mixed {
904     #[inline]
905     #[doc(hidden)]
906     #[no_coverage]
907     fn assert_receiver_is_total_eq(&self) -> () {
908         let _: ::core::cmp::AssertParamIsEq<u32>;
909     }
910 }
911 #[automatically_derived]
912 impl ::core::cmp::PartialOrd for Mixed {
913     #[inline]
914     fn partial_cmp(&self, other: &Mixed)
915         -> ::core::option::Option<::core::cmp::Ordering> {
916         let __self_tag = ::core::intrinsics::discriminant_value(self);
917         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
918         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
919             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
920                 match (self, other) {
921                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
922                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
923                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
924                         d1: __arg1_0, d2: __arg1_1 }) =>
925                         match ::core::cmp::PartialOrd::partial_cmp(__self_0,
926                                 __arg1_0) {
927                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
928                                 => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1),
929                             cmp => cmp,
930                         },
931                     _ =>
932                         ::core::option::Option::Some(::core::cmp::Ordering::Equal),
933                 },
934             cmp => cmp,
935         }
936     }
937 }
938 #[automatically_derived]
939 impl ::core::cmp::Ord for Mixed {
940     #[inline]
941     fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering {
942         let __self_tag = ::core::intrinsics::discriminant_value(self);
943         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
944         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
945             ::core::cmp::Ordering::Equal =>
946                 match (self, other) {
947                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
948                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
949                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
950                         d1: __arg1_0, d2: __arg1_1 }) =>
951                         match ::core::cmp::Ord::cmp(__self_0, __arg1_0) {
952                             ::core::cmp::Ordering::Equal =>
953                                 ::core::cmp::Ord::cmp(__self_1, __arg1_1),
954                             cmp => cmp,
955                         },
956                     _ => ::core::cmp::Ordering::Equal,
957                 },
958             cmp => cmp,
959         }
960     }
961 }
962
963 // An enum with no fieldless variants. Note that `Default` cannot be derived
964 // for this enum.
965 enum Fielded { X(u32), Y(bool), Z(Option<i32>), }
966 #[automatically_derived]
967 impl ::core::clone::Clone for Fielded {
968     #[inline]
969     fn clone(&self) -> Fielded {
970         match self {
971             Fielded::X(__self_0) =>
972                 Fielded::X(::core::clone::Clone::clone(__self_0)),
973             Fielded::Y(__self_0) =>
974                 Fielded::Y(::core::clone::Clone::clone(__self_0)),
975             Fielded::Z(__self_0) =>
976                 Fielded::Z(::core::clone::Clone::clone(__self_0)),
977         }
978     }
979 }
980 #[automatically_derived]
981 impl ::core::fmt::Debug for Fielded {
982     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
983         match self {
984             Fielded::X(__self_0) =>
985                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X",
986                     &__self_0),
987             Fielded::Y(__self_0) =>
988                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y",
989                     &__self_0),
990             Fielded::Z(__self_0) =>
991                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z",
992                     &__self_0),
993         }
994     }
995 }
996 #[automatically_derived]
997 impl ::core::hash::Hash for Fielded {
998     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
999         let __self_tag = ::core::intrinsics::discriminant_value(self);
1000         ::core::hash::Hash::hash(&__self_tag, state);
1001         match self {
1002             Fielded::X(__self_0) => ::core::hash::Hash::hash(__self_0, state),
1003             Fielded::Y(__self_0) => ::core::hash::Hash::hash(__self_0, state),
1004             Fielded::Z(__self_0) => ::core::hash::Hash::hash(__self_0, state),
1005         }
1006     }
1007 }
1008 impl ::core::marker::StructuralPartialEq for Fielded {}
1009 #[automatically_derived]
1010 impl ::core::cmp::PartialEq for Fielded {
1011     #[inline]
1012     fn eq(&self, other: &Fielded) -> bool {
1013         let __self_tag = ::core::intrinsics::discriminant_value(self);
1014         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1015         __self_tag == __arg1_tag &&
1016             match (self, other) {
1017                 (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1018                     *__self_0 == *__arg1_0,
1019                 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1020                     *__self_0 == *__arg1_0,
1021                 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1022                     *__self_0 == *__arg1_0,
1023                 _ => unsafe { ::core::intrinsics::unreachable() }
1024             }
1025     }
1026     #[inline]
1027     fn ne(&self, other: &Fielded) -> bool {
1028         let __self_tag = ::core::intrinsics::discriminant_value(self);
1029         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1030         __self_tag != __arg1_tag ||
1031             match (self, other) {
1032                 (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1033                     *__self_0 != *__arg1_0,
1034                 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1035                     *__self_0 != *__arg1_0,
1036                 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1037                     *__self_0 != *__arg1_0,
1038                 _ => unsafe { ::core::intrinsics::unreachable() }
1039             }
1040     }
1041 }
1042 impl ::core::marker::StructuralEq for Fielded {}
1043 #[automatically_derived]
1044 impl ::core::cmp::Eq for Fielded {
1045     #[inline]
1046     #[doc(hidden)]
1047     #[no_coverage]
1048     fn assert_receiver_is_total_eq(&self) -> () {
1049         let _: ::core::cmp::AssertParamIsEq<u32>;
1050         let _: ::core::cmp::AssertParamIsEq<bool>;
1051         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
1052     }
1053 }
1054 #[automatically_derived]
1055 impl ::core::cmp::PartialOrd for Fielded {
1056     #[inline]
1057     fn partial_cmp(&self, other: &Fielded)
1058         -> ::core::option::Option<::core::cmp::Ordering> {
1059         let __self_tag = ::core::intrinsics::discriminant_value(self);
1060         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1061         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
1062             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
1063                 match (self, other) {
1064                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1065                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1066                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1067                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1068                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1069                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1070                     _ => unsafe { ::core::intrinsics::unreachable() }
1071                 },
1072             cmp => cmp,
1073         }
1074     }
1075 }
1076 #[automatically_derived]
1077 impl ::core::cmp::Ord for Fielded {
1078     #[inline]
1079     fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering {
1080         let __self_tag = ::core::intrinsics::discriminant_value(self);
1081         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1082         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
1083             ::core::cmp::Ordering::Equal =>
1084                 match (self, other) {
1085                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1086                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1087                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1088                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1089                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1090                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1091                     _ => unsafe { ::core::intrinsics::unreachable() }
1092                 },
1093             cmp => cmp,
1094         }
1095     }
1096 }
1097
1098 // A union. Most builtin traits are not derivable for unions.
1099 pub union Union {
1100     pub b: bool,
1101     pub u: u32,
1102     pub i: i32,
1103 }
1104 #[automatically_derived]
1105 impl ::core::clone::Clone for Union {
1106     #[inline]
1107     fn clone(&self) -> Union {
1108         let _: ::core::clone::AssertParamIsCopy<Self>;
1109         *self
1110     }
1111 }
1112 #[automatically_derived]
1113 impl ::core::marker::Copy for Union { }