]> git.lizzy.rs Git - rust.git/blob - tests/ui/deriving/deriving-all-codegen.stdout
Rollup merge of #106766 - GuillaumeGomez:rm-stripper-dead-code, r=notriddle
[rust.git] / tests / 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         PackedNonCopy(::core::clone::Clone::clone(&self.0))
467     }
468 }
469 #[automatically_derived]
470 impl ::core::fmt::Debug for PackedNonCopy {
471     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
472         ::core::fmt::Formatter::debug_tuple_field1_finish(f, "PackedNonCopy",
473             &&self.0)
474     }
475 }
476 #[automatically_derived]
477 impl ::core::default::Default for PackedNonCopy {
478     #[inline]
479     fn default() -> PackedNonCopy {
480         PackedNonCopy(::core::default::Default::default())
481     }
482 }
483 #[automatically_derived]
484 impl ::core::hash::Hash for PackedNonCopy {
485     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
486         ::core::hash::Hash::hash(&self.0, state)
487     }
488 }
489 #[automatically_derived]
490 impl ::core::marker::StructuralPartialEq for PackedNonCopy { }
491 #[automatically_derived]
492 impl ::core::cmp::PartialEq for PackedNonCopy {
493     #[inline]
494     fn eq(&self, other: &PackedNonCopy) -> bool { self.0 == other.0 }
495 }
496 #[automatically_derived]
497 impl ::core::marker::StructuralEq for PackedNonCopy { }
498 #[automatically_derived]
499 impl ::core::cmp::Eq for PackedNonCopy {
500     #[inline]
501     #[doc(hidden)]
502     #[no_coverage]
503     fn assert_receiver_is_total_eq(&self) -> () {
504         let _: ::core::cmp::AssertParamIsEq<u8>;
505     }
506 }
507 #[automatically_derived]
508 impl ::core::cmp::PartialOrd for PackedNonCopy {
509     #[inline]
510     fn partial_cmp(&self, other: &PackedNonCopy)
511         -> ::core::option::Option<::core::cmp::Ordering> {
512         ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
513     }
514 }
515 #[automatically_derived]
516 impl ::core::cmp::Ord for PackedNonCopy {
517     #[inline]
518     fn cmp(&self, other: &PackedNonCopy) -> ::core::cmp::Ordering {
519         ::core::cmp::Ord::cmp(&self.0, &other.0)
520     }
521 }
522
523 // An empty enum.
524 enum Enum0 {}
525 #[automatically_derived]
526 impl ::core::clone::Clone for Enum0 {
527     #[inline]
528     fn clone(&self) -> Enum0 { *self }
529 }
530 #[automatically_derived]
531 impl ::core::marker::Copy for Enum0 { }
532 #[automatically_derived]
533 impl ::core::fmt::Debug for Enum0 {
534     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
535         unsafe { ::core::intrinsics::unreachable() }
536     }
537 }
538 #[automatically_derived]
539 impl ::core::hash::Hash for Enum0 {
540     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
541         unsafe { ::core::intrinsics::unreachable() }
542     }
543 }
544 #[automatically_derived]
545 impl ::core::marker::StructuralPartialEq for Enum0 { }
546 #[automatically_derived]
547 impl ::core::cmp::PartialEq for Enum0 {
548     #[inline]
549     fn eq(&self, other: &Enum0) -> bool {
550         unsafe { ::core::intrinsics::unreachable() }
551     }
552 }
553 #[automatically_derived]
554 impl ::core::marker::StructuralEq for Enum0 { }
555 #[automatically_derived]
556 impl ::core::cmp::Eq for Enum0 {
557     #[inline]
558     #[doc(hidden)]
559     #[no_coverage]
560     fn assert_receiver_is_total_eq(&self) -> () {}
561 }
562 #[automatically_derived]
563 impl ::core::cmp::PartialOrd for Enum0 {
564     #[inline]
565     fn partial_cmp(&self, other: &Enum0)
566         -> ::core::option::Option<::core::cmp::Ordering> {
567         unsafe { ::core::intrinsics::unreachable() }
568     }
569 }
570 #[automatically_derived]
571 impl ::core::cmp::Ord for Enum0 {
572     #[inline]
573     fn cmp(&self, other: &Enum0) -> ::core::cmp::Ordering {
574         unsafe { ::core::intrinsics::unreachable() }
575     }
576 }
577
578 // A single-variant enum.
579 enum Enum1 {
580     Single {
581         x: u32,
582     },
583 }
584 #[automatically_derived]
585 impl ::core::clone::Clone for Enum1 {
586     #[inline]
587     fn clone(&self) -> Enum1 {
588         match self {
589             Enum1::Single { x: __self_0 } =>
590                 Enum1::Single { x: ::core::clone::Clone::clone(__self_0) },
591         }
592     }
593 }
594 #[automatically_derived]
595 impl ::core::fmt::Debug for Enum1 {
596     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
597         match self {
598             Enum1::Single { x: __self_0 } =>
599                 ::core::fmt::Formatter::debug_struct_field1_finish(f,
600                     "Single", "x", &__self_0),
601         }
602     }
603 }
604 #[automatically_derived]
605 impl ::core::hash::Hash for Enum1 {
606     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
607         match self {
608             Enum1::Single { x: __self_0 } =>
609                 ::core::hash::Hash::hash(__self_0, state),
610         }
611     }
612 }
613 #[automatically_derived]
614 impl ::core::marker::StructuralPartialEq for Enum1 { }
615 #[automatically_derived]
616 impl ::core::cmp::PartialEq for Enum1 {
617     #[inline]
618     fn eq(&self, other: &Enum1) -> bool {
619         match (self, other) {
620             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
621                 *__self_0 == *__arg1_0,
622         }
623     }
624 }
625 #[automatically_derived]
626 impl ::core::marker::StructuralEq for Enum1 { }
627 #[automatically_derived]
628 impl ::core::cmp::Eq for Enum1 {
629     #[inline]
630     #[doc(hidden)]
631     #[no_coverage]
632     fn assert_receiver_is_total_eq(&self) -> () {
633         let _: ::core::cmp::AssertParamIsEq<u32>;
634     }
635 }
636 #[automatically_derived]
637 impl ::core::cmp::PartialOrd for Enum1 {
638     #[inline]
639     fn partial_cmp(&self, other: &Enum1)
640         -> ::core::option::Option<::core::cmp::Ordering> {
641         match (self, other) {
642             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
643                 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
644         }
645     }
646 }
647 #[automatically_derived]
648 impl ::core::cmp::Ord for Enum1 {
649     #[inline]
650     fn cmp(&self, other: &Enum1) -> ::core::cmp::Ordering {
651         match (self, other) {
652             (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
653                 ::core::cmp::Ord::cmp(__self_0, __arg1_0),
654         }
655     }
656 }
657
658 // A C-like, fieldless enum with a single variant.
659 enum Fieldless1 {
660
661     #[default]
662     A,
663 }
664 #[automatically_derived]
665 impl ::core::clone::Clone for Fieldless1 {
666     #[inline]
667     fn clone(&self) -> Fieldless1 { Fieldless1::A }
668 }
669 #[automatically_derived]
670 impl ::core::fmt::Debug for Fieldless1 {
671     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
672         ::core::fmt::Formatter::write_str(f, "A")
673     }
674 }
675 #[automatically_derived]
676 impl ::core::default::Default for Fieldless1 {
677     #[inline]
678     fn default() -> Fieldless1 { Self::A }
679 }
680 #[automatically_derived]
681 impl ::core::hash::Hash for Fieldless1 {
682     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {}
683 }
684 #[automatically_derived]
685 impl ::core::marker::StructuralPartialEq for Fieldless1 { }
686 #[automatically_derived]
687 impl ::core::cmp::PartialEq for Fieldless1 {
688     #[inline]
689     fn eq(&self, other: &Fieldless1) -> bool { true }
690 }
691 #[automatically_derived]
692 impl ::core::marker::StructuralEq for Fieldless1 { }
693 #[automatically_derived]
694 impl ::core::cmp::Eq for Fieldless1 {
695     #[inline]
696     #[doc(hidden)]
697     #[no_coverage]
698     fn assert_receiver_is_total_eq(&self) -> () {}
699 }
700 #[automatically_derived]
701 impl ::core::cmp::PartialOrd for Fieldless1 {
702     #[inline]
703     fn partial_cmp(&self, other: &Fieldless1)
704         -> ::core::option::Option<::core::cmp::Ordering> {
705         ::core::option::Option::Some(::core::cmp::Ordering::Equal)
706     }
707 }
708 #[automatically_derived]
709 impl ::core::cmp::Ord for Fieldless1 {
710     #[inline]
711     fn cmp(&self, other: &Fieldless1) -> ::core::cmp::Ordering {
712         ::core::cmp::Ordering::Equal
713     }
714 }
715
716 // A C-like, fieldless enum.
717 enum Fieldless {
718
719     #[default]
720     A,
721     B,
722     C,
723 }
724 #[automatically_derived]
725 impl ::core::clone::Clone for Fieldless {
726     #[inline]
727     fn clone(&self) -> Fieldless { *self }
728 }
729 #[automatically_derived]
730 impl ::core::marker::Copy for Fieldless { }
731 #[automatically_derived]
732 impl ::core::fmt::Debug for Fieldless {
733     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
734         match self {
735             Fieldless::A => ::core::fmt::Formatter::write_str(f, "A"),
736             Fieldless::B => ::core::fmt::Formatter::write_str(f, "B"),
737             Fieldless::C => ::core::fmt::Formatter::write_str(f, "C"),
738         }
739     }
740 }
741 #[automatically_derived]
742 impl ::core::default::Default for Fieldless {
743     #[inline]
744     fn default() -> Fieldless { Self::A }
745 }
746 #[automatically_derived]
747 impl ::core::hash::Hash for Fieldless {
748     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
749         let __self_tag = ::core::intrinsics::discriminant_value(self);
750         ::core::hash::Hash::hash(&__self_tag, state)
751     }
752 }
753 #[automatically_derived]
754 impl ::core::marker::StructuralPartialEq for Fieldless { }
755 #[automatically_derived]
756 impl ::core::cmp::PartialEq for Fieldless {
757     #[inline]
758     fn eq(&self, other: &Fieldless) -> bool {
759         let __self_tag = ::core::intrinsics::discriminant_value(self);
760         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
761         __self_tag == __arg1_tag
762     }
763 }
764 #[automatically_derived]
765 impl ::core::marker::StructuralEq for Fieldless { }
766 #[automatically_derived]
767 impl ::core::cmp::Eq for Fieldless {
768     #[inline]
769     #[doc(hidden)]
770     #[no_coverage]
771     fn assert_receiver_is_total_eq(&self) -> () {}
772 }
773 #[automatically_derived]
774 impl ::core::cmp::PartialOrd for Fieldless {
775     #[inline]
776     fn partial_cmp(&self, other: &Fieldless)
777         -> ::core::option::Option<::core::cmp::Ordering> {
778         let __self_tag = ::core::intrinsics::discriminant_value(self);
779         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
780         ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag)
781     }
782 }
783 #[automatically_derived]
784 impl ::core::cmp::Ord for Fieldless {
785     #[inline]
786     fn cmp(&self, other: &Fieldless) -> ::core::cmp::Ordering {
787         let __self_tag = ::core::intrinsics::discriminant_value(self);
788         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
789         ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag)
790     }
791 }
792
793 // An enum with multiple fieldless and fielded variants.
794 enum Mixed {
795
796     #[default]
797     P,
798     Q,
799     R(u32),
800     S {
801         d1: Option<u32>,
802         d2: Option<i32>,
803     },
804 }
805 #[automatically_derived]
806 impl ::core::clone::Clone for Mixed {
807     #[inline]
808     fn clone(&self) -> Mixed {
809         let _: ::core::clone::AssertParamIsClone<u32>;
810         let _: ::core::clone::AssertParamIsClone<Option<u32>>;
811         let _: ::core::clone::AssertParamIsClone<Option<i32>>;
812         *self
813     }
814 }
815 #[automatically_derived]
816 impl ::core::marker::Copy for Mixed { }
817 #[automatically_derived]
818 impl ::core::fmt::Debug for Mixed {
819     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
820         match self {
821             Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
822             Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"),
823             Mixed::R(__self_0) =>
824                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R",
825                     &__self_0),
826             Mixed::S { d1: __self_0, d2: __self_1 } =>
827                 ::core::fmt::Formatter::debug_struct_field2_finish(f, "S",
828                     "d1", &__self_0, "d2", &__self_1),
829         }
830     }
831 }
832 #[automatically_derived]
833 impl ::core::default::Default for Mixed {
834     #[inline]
835     fn default() -> Mixed { Self::P }
836 }
837 #[automatically_derived]
838 impl ::core::hash::Hash for Mixed {
839     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
840         let __self_tag = ::core::intrinsics::discriminant_value(self);
841         ::core::hash::Hash::hash(&__self_tag, state);
842         match self {
843             Mixed::R(__self_0) => ::core::hash::Hash::hash(__self_0, state),
844             Mixed::S { d1: __self_0, d2: __self_1 } => {
845                 ::core::hash::Hash::hash(__self_0, state);
846                 ::core::hash::Hash::hash(__self_1, state)
847             }
848             _ => {}
849         }
850     }
851 }
852 #[automatically_derived]
853 impl ::core::marker::StructuralPartialEq for Mixed { }
854 #[automatically_derived]
855 impl ::core::cmp::PartialEq for Mixed {
856     #[inline]
857     fn eq(&self, other: &Mixed) -> bool {
858         let __self_tag = ::core::intrinsics::discriminant_value(self);
859         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
860         __self_tag == __arg1_tag &&
861             match (self, other) {
862                 (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
863                     *__self_0 == *__arg1_0,
864                 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
865                     d1: __arg1_0, d2: __arg1_1 }) =>
866                     *__self_0 == *__arg1_0 && *__self_1 == *__arg1_1,
867                 _ => true,
868             }
869     }
870 }
871 #[automatically_derived]
872 impl ::core::marker::StructuralEq for Mixed { }
873 #[automatically_derived]
874 impl ::core::cmp::Eq for Mixed {
875     #[inline]
876     #[doc(hidden)]
877     #[no_coverage]
878     fn assert_receiver_is_total_eq(&self) -> () {
879         let _: ::core::cmp::AssertParamIsEq<u32>;
880         let _: ::core::cmp::AssertParamIsEq<Option<u32>>;
881         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
882     }
883 }
884 #[automatically_derived]
885 impl ::core::cmp::PartialOrd for Mixed {
886     #[inline]
887     fn partial_cmp(&self, other: &Mixed)
888         -> ::core::option::Option<::core::cmp::Ordering> {
889         let __self_tag = ::core::intrinsics::discriminant_value(self);
890         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
891         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
892             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
893                 match (self, other) {
894                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
895                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
896                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
897                         d1: __arg1_0, d2: __arg1_1 }) =>
898                         match ::core::cmp::PartialOrd::partial_cmp(__self_0,
899                                 __arg1_0) {
900                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
901                                 => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1),
902                             cmp => cmp,
903                         },
904                     _ =>
905                         ::core::option::Option::Some(::core::cmp::Ordering::Equal),
906                 },
907             cmp => cmp,
908         }
909     }
910 }
911 #[automatically_derived]
912 impl ::core::cmp::Ord for Mixed {
913     #[inline]
914     fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering {
915         let __self_tag = ::core::intrinsics::discriminant_value(self);
916         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
917         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
918             ::core::cmp::Ordering::Equal =>
919                 match (self, other) {
920                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
921                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
922                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
923                         d1: __arg1_0, d2: __arg1_1 }) =>
924                         match ::core::cmp::Ord::cmp(__self_0, __arg1_0) {
925                             ::core::cmp::Ordering::Equal =>
926                                 ::core::cmp::Ord::cmp(__self_1, __arg1_1),
927                             cmp => cmp,
928                         },
929                     _ => ::core::cmp::Ordering::Equal,
930                 },
931             cmp => cmp,
932         }
933     }
934 }
935
936 // An enum with no fieldless variants. Note that `Default` cannot be derived
937 // for this enum.
938 enum Fielded { X(u32), Y(bool), Z(Option<i32>), }
939 #[automatically_derived]
940 impl ::core::clone::Clone for Fielded {
941     #[inline]
942     fn clone(&self) -> Fielded {
943         match self {
944             Fielded::X(__self_0) =>
945                 Fielded::X(::core::clone::Clone::clone(__self_0)),
946             Fielded::Y(__self_0) =>
947                 Fielded::Y(::core::clone::Clone::clone(__self_0)),
948             Fielded::Z(__self_0) =>
949                 Fielded::Z(::core::clone::Clone::clone(__self_0)),
950         }
951     }
952 }
953 #[automatically_derived]
954 impl ::core::fmt::Debug for Fielded {
955     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
956         match self {
957             Fielded::X(__self_0) =>
958                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X",
959                     &__self_0),
960             Fielded::Y(__self_0) =>
961                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y",
962                     &__self_0),
963             Fielded::Z(__self_0) =>
964                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z",
965                     &__self_0),
966         }
967     }
968 }
969 #[automatically_derived]
970 impl ::core::hash::Hash for Fielded {
971     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
972         let __self_tag = ::core::intrinsics::discriminant_value(self);
973         ::core::hash::Hash::hash(&__self_tag, state);
974         match self {
975             Fielded::X(__self_0) => ::core::hash::Hash::hash(__self_0, state),
976             Fielded::Y(__self_0) => ::core::hash::Hash::hash(__self_0, state),
977             Fielded::Z(__self_0) => ::core::hash::Hash::hash(__self_0, state),
978         }
979     }
980 }
981 #[automatically_derived]
982 impl ::core::marker::StructuralPartialEq for Fielded { }
983 #[automatically_derived]
984 impl ::core::cmp::PartialEq for Fielded {
985     #[inline]
986     fn eq(&self, other: &Fielded) -> bool {
987         let __self_tag = ::core::intrinsics::discriminant_value(self);
988         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
989         __self_tag == __arg1_tag &&
990             match (self, other) {
991                 (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
992                     *__self_0 == *__arg1_0,
993                 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
994                     *__self_0 == *__arg1_0,
995                 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
996                     *__self_0 == *__arg1_0,
997                 _ => unsafe { ::core::intrinsics::unreachable() }
998             }
999     }
1000 }
1001 #[automatically_derived]
1002 impl ::core::marker::StructuralEq for Fielded { }
1003 #[automatically_derived]
1004 impl ::core::cmp::Eq for Fielded {
1005     #[inline]
1006     #[doc(hidden)]
1007     #[no_coverage]
1008     fn assert_receiver_is_total_eq(&self) -> () {
1009         let _: ::core::cmp::AssertParamIsEq<u32>;
1010         let _: ::core::cmp::AssertParamIsEq<bool>;
1011         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
1012     }
1013 }
1014 #[automatically_derived]
1015 impl ::core::cmp::PartialOrd for Fielded {
1016     #[inline]
1017     fn partial_cmp(&self, other: &Fielded)
1018         -> ::core::option::Option<::core::cmp::Ordering> {
1019         let __self_tag = ::core::intrinsics::discriminant_value(self);
1020         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1021         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
1022             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
1023                 match (self, other) {
1024                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1025                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1026                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1027                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1028                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1029                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1030                     _ => unsafe { ::core::intrinsics::unreachable() }
1031                 },
1032             cmp => cmp,
1033         }
1034     }
1035 }
1036 #[automatically_derived]
1037 impl ::core::cmp::Ord for Fielded {
1038     #[inline]
1039     fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering {
1040         let __self_tag = ::core::intrinsics::discriminant_value(self);
1041         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1042         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
1043             ::core::cmp::Ordering::Equal =>
1044                 match (self, other) {
1045                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1046                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1047                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1048                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1049                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1050                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1051                     _ => unsafe { ::core::intrinsics::unreachable() }
1052                 },
1053             cmp => cmp,
1054         }
1055     }
1056 }
1057
1058 // A union. Most builtin traits are not derivable for unions.
1059 pub union Union {
1060     pub b: bool,
1061     pub u: u32,
1062     pub i: i32,
1063 }
1064 #[automatically_derived]
1065 impl ::core::clone::Clone for Union {
1066     #[inline]
1067     fn clone(&self) -> Union {
1068         let _: ::core::clone::AssertParamIsCopy<Self>;
1069         *self
1070     }
1071 }
1072 #[automatically_derived]
1073 impl ::core::marker::Copy for Union { }