]> git.lizzy.rs Git - rust.git/blob - tests/ui/deriving/deriving-all-codegen.stdout
Rollup merge of #106113 - krasimirgg:llvm-16-ext-tyid, r=nikic
[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         ::core::fmt::Formatter::write_str(f,
735             match self {
736                 Fieldless::A => "A",
737                 Fieldless::B => "B",
738                 Fieldless::C => "C",
739             })
740     }
741 }
742 #[automatically_derived]
743 impl ::core::default::Default for Fieldless {
744     #[inline]
745     fn default() -> Fieldless { Self::A }
746 }
747 #[automatically_derived]
748 impl ::core::hash::Hash for Fieldless {
749     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
750         let __self_tag = ::core::intrinsics::discriminant_value(self);
751         ::core::hash::Hash::hash(&__self_tag, state)
752     }
753 }
754 #[automatically_derived]
755 impl ::core::marker::StructuralPartialEq for Fieldless { }
756 #[automatically_derived]
757 impl ::core::cmp::PartialEq for Fieldless {
758     #[inline]
759     fn eq(&self, other: &Fieldless) -> bool {
760         let __self_tag = ::core::intrinsics::discriminant_value(self);
761         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
762         __self_tag == __arg1_tag
763     }
764 }
765 #[automatically_derived]
766 impl ::core::marker::StructuralEq for Fieldless { }
767 #[automatically_derived]
768 impl ::core::cmp::Eq for Fieldless {
769     #[inline]
770     #[doc(hidden)]
771     #[no_coverage]
772     fn assert_receiver_is_total_eq(&self) -> () {}
773 }
774 #[automatically_derived]
775 impl ::core::cmp::PartialOrd for Fieldless {
776     #[inline]
777     fn partial_cmp(&self, other: &Fieldless)
778         -> ::core::option::Option<::core::cmp::Ordering> {
779         let __self_tag = ::core::intrinsics::discriminant_value(self);
780         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
781         ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag)
782     }
783 }
784 #[automatically_derived]
785 impl ::core::cmp::Ord for Fieldless {
786     #[inline]
787     fn cmp(&self, other: &Fieldless) -> ::core::cmp::Ordering {
788         let __self_tag = ::core::intrinsics::discriminant_value(self);
789         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
790         ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag)
791     }
792 }
793
794 // An enum with multiple fieldless and fielded variants.
795 enum Mixed {
796
797     #[default]
798     P,
799     Q,
800     R(u32),
801     S {
802         d1: Option<u32>,
803         d2: Option<i32>,
804     },
805 }
806 #[automatically_derived]
807 impl ::core::clone::Clone for Mixed {
808     #[inline]
809     fn clone(&self) -> Mixed {
810         let _: ::core::clone::AssertParamIsClone<u32>;
811         let _: ::core::clone::AssertParamIsClone<Option<u32>>;
812         let _: ::core::clone::AssertParamIsClone<Option<i32>>;
813         *self
814     }
815 }
816 #[automatically_derived]
817 impl ::core::marker::Copy for Mixed { }
818 #[automatically_derived]
819 impl ::core::fmt::Debug for Mixed {
820     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
821         match self {
822             Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
823             Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"),
824             Mixed::R(__self_0) =>
825                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R",
826                     &__self_0),
827             Mixed::S { d1: __self_0, d2: __self_1 } =>
828                 ::core::fmt::Formatter::debug_struct_field2_finish(f, "S",
829                     "d1", &__self_0, "d2", &__self_1),
830         }
831     }
832 }
833 #[automatically_derived]
834 impl ::core::default::Default for Mixed {
835     #[inline]
836     fn default() -> Mixed { Self::P }
837 }
838 #[automatically_derived]
839 impl ::core::hash::Hash for Mixed {
840     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
841         let __self_tag = ::core::intrinsics::discriminant_value(self);
842         ::core::hash::Hash::hash(&__self_tag, state);
843         match self {
844             Mixed::R(__self_0) => ::core::hash::Hash::hash(__self_0, state),
845             Mixed::S { d1: __self_0, d2: __self_1 } => {
846                 ::core::hash::Hash::hash(__self_0, state);
847                 ::core::hash::Hash::hash(__self_1, state)
848             }
849             _ => {}
850         }
851     }
852 }
853 #[automatically_derived]
854 impl ::core::marker::StructuralPartialEq for Mixed { }
855 #[automatically_derived]
856 impl ::core::cmp::PartialEq for Mixed {
857     #[inline]
858     fn eq(&self, other: &Mixed) -> bool {
859         let __self_tag = ::core::intrinsics::discriminant_value(self);
860         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
861         __self_tag == __arg1_tag &&
862             match (self, other) {
863                 (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
864                     *__self_0 == *__arg1_0,
865                 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
866                     d1: __arg1_0, d2: __arg1_1 }) =>
867                     *__self_0 == *__arg1_0 && *__self_1 == *__arg1_1,
868                 _ => true,
869             }
870     }
871 }
872 #[automatically_derived]
873 impl ::core::marker::StructuralEq for Mixed { }
874 #[automatically_derived]
875 impl ::core::cmp::Eq for Mixed {
876     #[inline]
877     #[doc(hidden)]
878     #[no_coverage]
879     fn assert_receiver_is_total_eq(&self) -> () {
880         let _: ::core::cmp::AssertParamIsEq<u32>;
881         let _: ::core::cmp::AssertParamIsEq<Option<u32>>;
882         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
883     }
884 }
885 #[automatically_derived]
886 impl ::core::cmp::PartialOrd for Mixed {
887     #[inline]
888     fn partial_cmp(&self, other: &Mixed)
889         -> ::core::option::Option<::core::cmp::Ordering> {
890         let __self_tag = ::core::intrinsics::discriminant_value(self);
891         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
892         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
893             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
894                 match (self, other) {
895                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
896                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
897                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
898                         d1: __arg1_0, d2: __arg1_1 }) =>
899                         match ::core::cmp::PartialOrd::partial_cmp(__self_0,
900                                 __arg1_0) {
901                             ::core::option::Option::Some(::core::cmp::Ordering::Equal)
902                                 => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1),
903                             cmp => cmp,
904                         },
905                     _ =>
906                         ::core::option::Option::Some(::core::cmp::Ordering::Equal),
907                 },
908             cmp => cmp,
909         }
910     }
911 }
912 #[automatically_derived]
913 impl ::core::cmp::Ord for Mixed {
914     #[inline]
915     fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering {
916         let __self_tag = ::core::intrinsics::discriminant_value(self);
917         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
918         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
919             ::core::cmp::Ordering::Equal =>
920                 match (self, other) {
921                     (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
922                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
923                     (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
924                         d1: __arg1_0, d2: __arg1_1 }) =>
925                         match ::core::cmp::Ord::cmp(__self_0, __arg1_0) {
926                             ::core::cmp::Ordering::Equal =>
927                                 ::core::cmp::Ord::cmp(__self_1, __arg1_1),
928                             cmp => cmp,
929                         },
930                     _ => ::core::cmp::Ordering::Equal,
931                 },
932             cmp => cmp,
933         }
934     }
935 }
936
937 // An enum with no fieldless variants. Note that `Default` cannot be derived
938 // for this enum.
939 enum Fielded { X(u32), Y(bool), Z(Option<i32>), }
940 #[automatically_derived]
941 impl ::core::clone::Clone for Fielded {
942     #[inline]
943     fn clone(&self) -> Fielded {
944         match self {
945             Fielded::X(__self_0) =>
946                 Fielded::X(::core::clone::Clone::clone(__self_0)),
947             Fielded::Y(__self_0) =>
948                 Fielded::Y(::core::clone::Clone::clone(__self_0)),
949             Fielded::Z(__self_0) =>
950                 Fielded::Z(::core::clone::Clone::clone(__self_0)),
951         }
952     }
953 }
954 #[automatically_derived]
955 impl ::core::fmt::Debug for Fielded {
956     fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
957         match self {
958             Fielded::X(__self_0) =>
959                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X",
960                     &__self_0),
961             Fielded::Y(__self_0) =>
962                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y",
963                     &__self_0),
964             Fielded::Z(__self_0) =>
965                 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z",
966                     &__self_0),
967         }
968     }
969 }
970 #[automatically_derived]
971 impl ::core::hash::Hash for Fielded {
972     fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
973         let __self_tag = ::core::intrinsics::discriminant_value(self);
974         ::core::hash::Hash::hash(&__self_tag, state);
975         match self {
976             Fielded::X(__self_0) => ::core::hash::Hash::hash(__self_0, state),
977             Fielded::Y(__self_0) => ::core::hash::Hash::hash(__self_0, state),
978             Fielded::Z(__self_0) => ::core::hash::Hash::hash(__self_0, state),
979         }
980     }
981 }
982 #[automatically_derived]
983 impl ::core::marker::StructuralPartialEq for Fielded { }
984 #[automatically_derived]
985 impl ::core::cmp::PartialEq for Fielded {
986     #[inline]
987     fn eq(&self, other: &Fielded) -> bool {
988         let __self_tag = ::core::intrinsics::discriminant_value(self);
989         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
990         __self_tag == __arg1_tag &&
991             match (self, other) {
992                 (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
993                     *__self_0 == *__arg1_0,
994                 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
995                     *__self_0 == *__arg1_0,
996                 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
997                     *__self_0 == *__arg1_0,
998                 _ => unsafe { ::core::intrinsics::unreachable() }
999             }
1000     }
1001 }
1002 #[automatically_derived]
1003 impl ::core::marker::StructuralEq for Fielded { }
1004 #[automatically_derived]
1005 impl ::core::cmp::Eq for Fielded {
1006     #[inline]
1007     #[doc(hidden)]
1008     #[no_coverage]
1009     fn assert_receiver_is_total_eq(&self) -> () {
1010         let _: ::core::cmp::AssertParamIsEq<u32>;
1011         let _: ::core::cmp::AssertParamIsEq<bool>;
1012         let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
1013     }
1014 }
1015 #[automatically_derived]
1016 impl ::core::cmp::PartialOrd for Fielded {
1017     #[inline]
1018     fn partial_cmp(&self, other: &Fielded)
1019         -> ::core::option::Option<::core::cmp::Ordering> {
1020         let __self_tag = ::core::intrinsics::discriminant_value(self);
1021         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1022         match ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) {
1023             ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
1024                 match (self, other) {
1025                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1026                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1027                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1028                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1029                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1030                         ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
1031                     _ => unsafe { ::core::intrinsics::unreachable() }
1032                 },
1033             cmp => cmp,
1034         }
1035     }
1036 }
1037 #[automatically_derived]
1038 impl ::core::cmp::Ord for Fielded {
1039     #[inline]
1040     fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering {
1041         let __self_tag = ::core::intrinsics::discriminant_value(self);
1042         let __arg1_tag = ::core::intrinsics::discriminant_value(other);
1043         match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) {
1044             ::core::cmp::Ordering::Equal =>
1045                 match (self, other) {
1046                     (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1047                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1048                     (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1049                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1050                     (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1051                         ::core::cmp::Ord::cmp(__self_0, __arg1_0),
1052                     _ => unsafe { ::core::intrinsics::unreachable() }
1053                 },
1054             cmp => cmp,
1055         }
1056     }
1057 }
1058
1059 // A union. Most builtin traits are not derivable for unions.
1060 pub union Union {
1061     pub b: bool,
1062     pub u: u32,
1063     pub i: i32,
1064 }
1065 #[automatically_derived]
1066 impl ::core::clone::Clone for Union {
1067     #[inline]
1068     fn clone(&self) -> Union {
1069         let _: ::core::clone::AssertParamIsCopy<Self>;
1070         *self
1071     }
1072 }
1073 #[automatically_derived]
1074 impl ::core::marker::Copy for Union { }