]> git.lizzy.rs Git - rust.git/blob - src/test/ui/deriving/deriving-all-codegen.stdout
:arrow_up: rust-analyzer
[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: Option<u32>,
813         d2: Option<i32>,
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         let _: ::core::clone::AssertParamIsClone<Option<u32>>;
822         let _: ::core::clone::AssertParamIsClone<Option<i32>>;
823         *self
824     }
825 }
826 #[automatically_derived]
827 impl ::core::marker::Copy for Mixed { }
828 #[automatically_derived]
829 impl ::core::fmt::Debug for Mixed {
830     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
831         match self {
832             Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
833             Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"),
834             Mixed::R(__self_0) =>
835                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R",
836                     &__self_0),
837             Mixed::S { d1: __self_0, d2: __self_1 } =>
838                 ::core::fmt::Formatter::debug_struct_field2_finish(f, "S",
839                     "d1", &__self_0, "d2", &__self_1),
840         }
841     }
842 }
843 #[automatically_derived]
844 impl ::core::default::Default for Mixed {
845     #[inline]
846     fn default() -> Mixed { Self::P }
847 }
848 #[automatically_derived]
849 impl ::core::hash::Hash for Mixed {
850     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
851         let __self_tag = ::core::intrinsics::discriminant_value(self);
852         ::core::hash::Hash::hash(&__self_tag, state);
853         match self {
854             Mixed::R(__self_0) => ::core::hash::Hash::hash(__self_0, state),
855             Mixed::S { d1: __self_0, d2: __self_1 } => {
856                 ::core::hash::Hash::hash(__self_0, state);
857                 ::core::hash::Hash::hash(__self_1, state)
858             }
859             _ => {}
860         }
861     }
862 }
863 #[automatically_derived]
864 impl ::core::marker::StructuralPartialEq for Mixed { }
865 #[automatically_derived]
866 impl ::core::cmp::PartialEq for Mixed {
867     #[inline]
868     fn eq(&self, other: &Mixed) -> bool {
869         let __self_tag = ::core::intrinsics::discriminant_value(self);
870         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
871         __self_tag == __arg1_tag &&
872             match (self, other) {
873                 (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
874                     *__self_0 == *__arg1_0,
875                 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
876                     d1: __arg1_0, d2: __arg1_1 }) =>
877                     *__self_0 == *__arg1_0 && *__self_1 == *__arg1_1,
878                 _ => true,
879             }
880     }
881 }
882 #[automatically_derived]
883 impl ::core::marker::StructuralEq for Mixed { }
884 #[automatically_derived]
885 impl ::core::cmp::Eq for Mixed {
886     #[inline]
887     #[doc(hidden)]
888     #[no_coverage]
889     fn assert_receiver_is_total_eq(&self) -> () {
890         let _: ::core::cmp::AssertParamIsEq<u32>;
891         let _: ::core::cmp::AssertParamIsEq<Option<u32>>;
892         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
893     }
894 }
895 #[automatically_derived]
896 impl ::core::cmp::PartialOrd for Mixed {
897     #[inline]
898     fn partial_cmp(&self, other: &Mixed)
899         -> ::core::option::Option<::core::cmp::Ordering> {
900         let __self_tag = ::core::intrinsics::discriminant_value(self);
901         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
902         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
903             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
904                 match (self, other) {
905                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
906                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
907                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
908                         d1: __arg1_0, d2: __arg1_1 }) =>
909                         match ::core::cmp::PartialOrd::partial_cmp(__self_0,
910                                 __arg1_0) {
911                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
912                                 => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1),
913                             cmp => cmp,
914                         },
915                     _ =>
916                         ::core::option::Option::Some(::core::cmp::Ordering::Equal),
917                 },
918             cmp => cmp,
919         }
920     }
921 }
922 #[automatically_derived]
923 impl ::core::cmp::Ord for Mixed {
924     #[inline]
925     fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering {
926         let __self_tag = ::core::intrinsics::discriminant_value(self);
927         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
928         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
929             ::core::cmp::Ordering::Equal =>
930                 match (self, other) {
931                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
932                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
933                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
934                         d1: __arg1_0, d2: __arg1_1 }) =>
935                         match ::core::cmp::Ord::cmp(__self_0, __arg1_0) {
936                             ::core::cmp::Ordering::Equal =>
937                                 ::core::cmp::Ord::cmp(__self_1, __arg1_1),
938                             cmp => cmp,
939                         },
940                     _ => ::core::cmp::Ordering::Equal,
941                 },
942             cmp => cmp,
943         }
944     }
945 }
946
947 // An enum with no fieldless variants. Note that `Default` cannot be derived
948 // for this enum.
949 enum Fielded { X(u32), Y(bool), Z(Option<i32>), }
950 #[automatically_derived]
951 impl ::core::clone::Clone for Fielded {
952     #[inline]
953     fn clone(&self) -> Fielded {
954         match self {
955             Fielded::X(__self_0) =>
956                 Fielded::X(::core::clone::Clone::clone(__self_0)),
957             Fielded::Y(__self_0) =>
958                 Fielded::Y(::core::clone::Clone::clone(__self_0)),
959             Fielded::Z(__self_0) =>
960                 Fielded::Z(::core::clone::Clone::clone(__self_0)),
961         }
962     }
963 }
964 #[automatically_derived]
965 impl ::core::fmt::Debug for Fielded {
966     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
967         match self {
968             Fielded::X(__self_0) =>
969                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X",
970                     &__self_0),
971             Fielded::Y(__self_0) =>
972                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y",
973                     &__self_0),
974             Fielded::Z(__self_0) =>
975                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z",
976                     &__self_0),
977         }
978     }
979 }
980 #[automatically_derived]
981 impl ::core::hash::Hash for Fielded {
982     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
983         let __self_tag = ::core::intrinsics::discriminant_value(self);
984         ::core::hash::Hash::hash(&__self_tag, state);
985         match self {
986             Fielded::X(__self_0) => ::core::hash::Hash::hash(__self_0, state),
987             Fielded::Y(__self_0) => ::core::hash::Hash::hash(__self_0, state),
988             Fielded::Z(__self_0) => ::core::hash::Hash::hash(__self_0, state),
989         }
990     }
991 }
992 #[automatically_derived]
993 impl ::core::marker::StructuralPartialEq for Fielded { }
994 #[automatically_derived]
995 impl ::core::cmp::PartialEq for Fielded {
996     #[inline]
997     fn eq(&self, other: &Fielded) -> bool {
998         let __self_tag = ::core::intrinsics::discriminant_value(self);
999         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1000         __self_tag == __arg1_tag &&
1001             match (self, other) {
1002                 (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1003                     *__self_0 == *__arg1_0,
1004                 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1005                     *__self_0 == *__arg1_0,
1006                 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1007                     *__self_0 == *__arg1_0,
1008                 _ => unsafe { ::core::intrinsics::unreachable() }
1009             }
1010     }
1011 }
1012 #[automatically_derived]
1013 impl ::core::marker::StructuralEq for Fielded { }
1014 #[automatically_derived]
1015 impl ::core::cmp::Eq for Fielded {
1016     #[inline]
1017     #[doc(hidden)]
1018     #[no_coverage]
1019     fn assert_receiver_is_total_eq(&self) -> () {
1020         let _: ::core::cmp::AssertParamIsEq<u32>;
1021         let _: ::core::cmp::AssertParamIsEq<bool>;
1022         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
1023     }
1024 }
1025 #[automatically_derived]
1026 impl ::core::cmp::PartialOrd for Fielded {
1027     #[inline]
1028     fn partial_cmp(&self, other: &Fielded)
1029         -> ::core::option::Option<::core::cmp::Ordering> {
1030         let __self_tag = ::core::intrinsics::discriminant_value(self);
1031         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1032         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
1033             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
1034                 match (self, other) {
1035                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1036                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1037                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1038                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1039                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1040                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1041                     _ => unsafe { ::core::intrinsics::unreachable() }
1042                 },
1043             cmp => cmp,
1044         }
1045     }
1046 }
1047 #[automatically_derived]
1048 impl ::core::cmp::Ord for Fielded {
1049     #[inline]
1050     fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering {
1051         let __self_tag = ::core::intrinsics::discriminant_value(self);
1052         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1053         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
1054             ::core::cmp::Ordering::Equal =>
1055                 match (self, other) {
1056                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1057                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1058                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1059                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1060                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1061                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1062                     _ => unsafe { ::core::intrinsics::unreachable() }
1063                 },
1064             cmp => cmp,
1065         }
1066     }
1067 }
1068
1069 // A union. Most builtin traits are not derivable for unions.
1070 pub union Union {
1071     pub b: bool,
1072     pub u: u32,
1073     pub i: i32,
1074 }
1075 #[automatically_derived]
1076 impl ::core::clone::Clone for Union {
1077     #[inline]
1078     fn clone(&self) -> Union {
1079         let _: ::core::clone::AssertParamIsCopy<Self>;
1080         *self
1081     }
1082 }
1083 #[automatically_derived]
1084 impl ::core::marker::Copy for Union { }