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