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