fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
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] 21use std::prelude::rust_2021::*; 22#[macro_use] 23extern crate std; 24 25// Empty struct. 26struct Empty; 27#[automatically_derived] 28impl ::core::clone::Clone for Empty { 29 #[inline] 30 fn clone(&self) -> Empty { *self } 31} 32#[automatically_derived] 33impl ::core::marker::Copy for Empty { } 34#[automatically_derived] 35impl ::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] 41impl ::core::default::Default for Empty { 42 #[inline] 43 fn default() -> Empty { Empty {} } 44} 45#[automatically_derived] 46impl ::core::hash::Hash for Empty { 47 #[inline] 48 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {} 49} 50#[automatically_derived] 51impl ::core::marker::StructuralPartialEq for Empty { } 52#[automatically_derived] 53impl ::core::cmp::PartialEq for Empty { 54 #[inline] 55 fn eq(&self, other: &Empty) -> bool { true } 56} 57#[automatically_derived] 58impl ::core::marker::StructuralEq for Empty { } 59#[automatically_derived] 60impl ::core::cmp::Eq for Empty { 61 #[inline] 62 #[doc(hidden)] 63 #[coverage(off)] 64 fn assert_receiver_is_total_eq(&self) -> () {} 65} 66#[automatically_derived] 67impl ::core::cmp::PartialOrd for Empty { 68 #[inline] 69 fn partial_cmp(&self, other: &Empty) 70 -> ::core::option::Option<::core::cmp::Ordering> { 71 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 72 } 73} 74#[automatically_derived] 75impl ::core::cmp::Ord for Empty { 76 #[inline] 77 fn cmp(&self, other: &Empty) -> ::core::cmp::Ordering { 78 ::core::cmp::Ordering::Equal 79 } 80} 81 82// A basic struct. Note: because this derives `Copy`, it gets the simple 83// `clone` implemention that just does `*self`. 84struct Point { 85 x: u32, 86 y: u32, 87} 88#[automatically_derived] 89impl ::core::clone::Clone for Point { 90 #[inline] 91 fn clone(&self) -> Point { 92 let _: ::core::clone::AssertParamIsClone<u32>; 93 *self 94 } 95} 96#[automatically_derived] 97impl ::core::marker::Copy for Point { } 98#[automatically_derived] 99impl ::core::fmt::Debug for Point { 100 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 101 ::core::fmt::Formatter::debug_struct_field2_finish(f, "Point", "x", 102 &self.x, "y", &&self.y) 103 } 104} 105#[automatically_derived] 106impl ::core::default::Default for Point { 107 #[inline] 108 fn default() -> Point { 109 Point { 110 x: ::core::default::Default::default(), 111 y: ::core::default::Default::default(), 112 } 113 } 114} 115#[automatically_derived] 116impl ::core::hash::Hash for Point { 117 #[inline] 118 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 119 ::core::hash::Hash::hash(&self.x, state); 120 ::core::hash::Hash::hash(&self.y, state) 121 } 122} 123#[automatically_derived] 124impl ::core::marker::StructuralPartialEq for Point { } 125#[automatically_derived] 126impl ::core::cmp::PartialEq for Point { 127 #[inline] 128 fn eq(&self, other: &Point) -> bool { 129 self.x == other.x && self.y == other.y 130 } 131} 132#[automatically_derived] 133impl ::core::marker::StructuralEq for Point { } 134#[automatically_derived] 135impl ::core::cmp::Eq for Point { 136 #[inline] 137 #[doc(hidden)] 138 #[coverage(off)] 139 fn assert_receiver_is_total_eq(&self) -> () { 140 let _: ::core::cmp::AssertParamIsEq<u32>; 141 } 142} 143#[automatically_derived] 144impl ::core::cmp::PartialOrd for Point { 145 #[inline] 146 fn partial_cmp(&self, other: &Point) 147 -> ::core::option::Option<::core::cmp::Ordering> { 148 match ::core::cmp::PartialOrd::partial_cmp(&self.x, &other.x) { 149 ::core::option::Option::Some(::core::cmp::Ordering::Equal) => 150 ::core::cmp::PartialOrd::partial_cmp(&self.y, &other.y), 151 cmp => cmp, 152 } 153 } 154} 155#[automatically_derived] 156impl ::core::cmp::Ord for Point { 157 #[inline] 158 fn cmp(&self, other: &Point) -> ::core::cmp::Ordering { 159 match ::core::cmp::Ord::cmp(&self.x, &other.x) { 160 ::core::cmp::Ordering::Equal => 161 ::core::cmp::Ord::cmp(&self.y, &other.y), 162 cmp => cmp, 163 } 164 } 165} 166 167// A basic packed struct. Note: because this derives `Copy`, it gets the simple 168// `clone` implemention that just does `*self`. 169#[repr(packed)] 170struct PackedPoint { 171 x: u32, 172 y: u32, 173} 174#[automatically_derived] 175impl ::core::clone::Clone for PackedPoint { 176 #[inline] 177 fn clone(&self) -> PackedPoint { 178 let _: ::core::clone::AssertParamIsClone<u32>; 179 *self 180 } 181} 182#[automatically_derived] 183impl ::core::marker::Copy for PackedPoint { } 184#[automatically_derived] 185impl ::core::fmt::Debug for PackedPoint { 186 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 187 ::core::fmt::Formatter::debug_struct_field2_finish(f, "PackedPoint", 188 "x", &{ self.x }, "y", &&{ self.y }) 189 } 190} 191#[automatically_derived] 192impl ::core::default::Default for PackedPoint { 193 #[inline] 194 fn default() -> PackedPoint { 195 PackedPoint { 196 x: ::core::default::Default::default(), 197 y: ::core::default::Default::default(), 198 } 199 } 200} 201#[automatically_derived] 202impl ::core::hash::Hash for PackedPoint { 203 #[inline] 204 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 205 ::core::hash::Hash::hash(&{ self.x }, state); 206 ::core::hash::Hash::hash(&{ self.y }, state) 207 } 208} 209#[automatically_derived] 210impl ::core::marker::StructuralPartialEq for PackedPoint { } 211#[automatically_derived] 212impl ::core::cmp::PartialEq for PackedPoint { 213 #[inline] 214 fn eq(&self, other: &PackedPoint) -> bool { 215 ({ self.x }) == ({ other.x }) && ({ self.y }) == ({ other.y }) 216 } 217} 218#[automatically_derived] 219impl ::core::marker::StructuralEq for PackedPoint { } 220#[automatically_derived] 221impl ::core::cmp::Eq for PackedPoint { 222 #[inline] 223 #[doc(hidden)] 224 #[coverage(off)] 225 fn assert_receiver_is_total_eq(&self) -> () { 226 let _: ::core::cmp::AssertParamIsEq<u32>; 227 } 228} 229#[automatically_derived] 230impl ::core::cmp::PartialOrd for PackedPoint { 231 #[inline] 232 fn partial_cmp(&self, other: &PackedPoint) 233 -> ::core::option::Option<::core::cmp::Ordering> { 234 match ::core::cmp::PartialOrd::partial_cmp(&{ self.x }, &{ other.x }) 235 { 236 ::core::option::Option::Some(::core::cmp::Ordering::Equal) => 237 ::core::cmp::PartialOrd::partial_cmp(&{ self.y }, 238 &{ other.y }), 239 cmp => cmp, 240 } 241 } 242} 243#[automatically_derived] 244impl ::core::cmp::Ord for PackedPoint { 245 #[inline] 246 fn cmp(&self, other: &PackedPoint) -> ::core::cmp::Ordering { 247 match ::core::cmp::Ord::cmp(&{ self.x }, &{ other.x }) { 248 ::core::cmp::Ordering::Equal => 249 ::core::cmp::Ord::cmp(&{ self.y }, &{ other.y }), 250 cmp => cmp, 251 } 252 } 253} 254 255// A large struct. Note: because this derives `Copy`, it gets the simple 256// `clone` implemention that just does `*self`. 257struct Big { 258 b1: u32, 259 b2: u32, 260 b3: u32, 261 b4: u32, 262 b5: u32, 263 b6: u32, 264 b7: u32, 265 b8: u32, 266} 267#[automatically_derived] 268impl ::core::clone::Clone for Big { 269 #[inline] 270 fn clone(&self) -> Big { 271 let _: ::core::clone::AssertParamIsClone<u32>; 272 *self 273 } 274} 275#[automatically_derived] 276impl ::core::marker::Copy for Big { } 277#[automatically_derived] 278impl ::core::fmt::Debug for Big { 279 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 280 let names: &'static _ = 281 &["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"]; 282 let values: &[&dyn ::core::fmt::Debug] = 283 &[&self.b1, &self.b2, &self.b3, &self.b4, &self.b5, &self.b6, 284 &self.b7, &&self.b8]; 285 ::core::fmt::Formatter::debug_struct_fields_finish(f, "Big", names, 286 values) 287 } 288} 289#[automatically_derived] 290impl ::core::default::Default for Big { 291 #[inline] 292 fn default() -> Big { 293 Big { 294 b1: ::core::default::Default::default(), 295 b2: ::core::default::Default::default(), 296 b3: ::core::default::Default::default(), 297 b4: ::core::default::Default::default(), 298 b5: ::core::default::Default::default(), 299 b6: ::core::default::Default::default(), 300 b7: ::core::default::Default::default(), 301 b8: ::core::default::Default::default(), 302 } 303 } 304} 305#[automatically_derived] 306impl ::core::hash::Hash for Big { 307 #[inline] 308 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 309 ::core::hash::Hash::hash(&self.b1, state); 310 ::core::hash::Hash::hash(&self.b2, state); 311 ::core::hash::Hash::hash(&self.b3, state); 312 ::core::hash::Hash::hash(&self.b4, state); 313 ::core::hash::Hash::hash(&self.b5, state); 314 ::core::hash::Hash::hash(&self.b6, state); 315 ::core::hash::Hash::hash(&self.b7, state); 316 ::core::hash::Hash::hash(&self.b8, state) 317 } 318} 319#[automatically_derived] 320impl ::core::marker::StructuralPartialEq for Big { } 321#[automatically_derived] 322impl ::core::cmp::PartialEq for Big { 323 #[inline] 324 fn eq(&self, other: &Big) -> bool { 325 self.b1 == other.b1 && self.b2 == other.b2 && self.b3 == other.b3 && 326 self.b4 == other.b4 && self.b5 == other.b5 && 327 self.b6 == other.b6 && self.b7 == other.b7 && 328 self.b8 == other.b8 329 } 330} 331#[automatically_derived] 332impl ::core::marker::StructuralEq for Big { } 333#[automatically_derived] 334impl ::core::cmp::Eq for Big { 335 #[inline] 336 #[doc(hidden)] 337 #[coverage(off)] 338 fn assert_receiver_is_total_eq(&self) -> () { 339 let _: ::core::cmp::AssertParamIsEq<u32>; 340 } 341} 342#[automatically_derived] 343impl ::core::cmp::PartialOrd for Big { 344 #[inline] 345 fn partial_cmp(&self, other: &Big) 346 -> ::core::option::Option<::core::cmp::Ordering> { 347 match ::core::cmp::PartialOrd::partial_cmp(&self.b1, &other.b1) { 348 ::core::option::Option::Some(::core::cmp::Ordering::Equal) => 349 match ::core::cmp::PartialOrd::partial_cmp(&self.b2, 350 &other.b2) { 351 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 352 => 353 match ::core::cmp::PartialOrd::partial_cmp(&self.b3, 354 &other.b3) { 355 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 356 => 357 match ::core::cmp::PartialOrd::partial_cmp(&self.b4, 358 &other.b4) { 359 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 360 => 361 match ::core::cmp::PartialOrd::partial_cmp(&self.b5, 362 &other.b5) { 363 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 364 => 365 match ::core::cmp::PartialOrd::partial_cmp(&self.b6, 366 &other.b6) { 367 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 368 => 369 match ::core::cmp::PartialOrd::partial_cmp(&self.b7, 370 &other.b7) { 371 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 372 => 373 ::core::cmp::PartialOrd::partial_cmp(&self.b8, &other.b8), 374 cmp => cmp, 375 }, 376 cmp => cmp, 377 }, 378 cmp => cmp, 379 }, 380 cmp => cmp, 381 }, 382 cmp => cmp, 383 }, 384 cmp => cmp, 385 }, 386 cmp => cmp, 387 } 388 } 389} 390#[automatically_derived] 391impl ::core::cmp::Ord for Big { 392 #[inline] 393 fn cmp(&self, other: &Big) -> ::core::cmp::Ordering { 394 match ::core::cmp::Ord::cmp(&self.b1, &other.b1) { 395 ::core::cmp::Ordering::Equal => 396 match ::core::cmp::Ord::cmp(&self.b2, &other.b2) { 397 ::core::cmp::Ordering::Equal => 398 match ::core::cmp::Ord::cmp(&self.b3, &other.b3) { 399 ::core::cmp::Ordering::Equal => 400 match ::core::cmp::Ord::cmp(&self.b4, &other.b4) { 401 ::core::cmp::Ordering::Equal => 402 match ::core::cmp::Ord::cmp(&self.b5, &other.b5) { 403 ::core::cmp::Ordering::Equal => 404 match ::core::cmp::Ord::cmp(&self.b6, &other.b6) { 405 ::core::cmp::Ordering::Equal => 406 match ::core::cmp::Ord::cmp(&self.b7, &other.b7) { 407 ::core::cmp::Ordering::Equal => 408 ::core::cmp::Ord::cmp(&self.b8, &other.b8), 409 cmp => cmp, 410 }, 411 cmp => cmp, 412 }, 413 cmp => cmp, 414 }, 415 cmp => cmp, 416 }, 417 cmp => cmp, 418 }, 419 cmp => cmp, 420 }, 421 cmp => cmp, 422 } 423 } 424} 425 426// A struct that doesn't impl `Copy`, which means it gets the non-simple 427// `clone` implemention that clones the fields individually. 428struct NonCopy(u32); 429#[automatically_derived] 430impl ::core::clone::Clone for NonCopy { 431 #[inline] 432 fn clone(&self) -> NonCopy { 433 NonCopy(::core::clone::Clone::clone(&self.0)) 434 } 435} 436 437// A packed struct that doesn't impl `Copy`, which means it gets the non-simple 438// `clone` implemention that clones the fields individually. 439#[repr(packed)] 440struct PackedNonCopy(u32); 441#[automatically_derived] 442impl ::core::clone::Clone for PackedNonCopy { 443 #[inline] 444 fn clone(&self) -> PackedNonCopy { 445 PackedNonCopy(::core::clone::Clone::clone(&{ self.0 })) 446 } 447} 448 449// A struct that impls `Copy` manually, which means it gets the non-simple 450// `clone` implemention that clones the fields individually. 451struct ManualCopy(u32); 452#[automatically_derived] 453impl ::core::clone::Clone for ManualCopy { 454 #[inline] 455 fn clone(&self) -> ManualCopy { 456 ManualCopy(::core::clone::Clone::clone(&self.0)) 457 } 458} 459impl Copy for ManualCopy {} 460 461// A packed struct that impls `Copy` manually, which means it gets the 462// non-simple `clone` implemention that clones the fields individually. 463#[repr(packed)] 464struct PackedManualCopy(u32); 465#[automatically_derived] 466impl ::core::clone::Clone for PackedManualCopy { 467 #[inline] 468 fn clone(&self) -> PackedManualCopy { 469 PackedManualCopy(::core::clone::Clone::clone(&{ self.0 })) 470 } 471} 472impl Copy for PackedManualCopy {} 473 474// A struct with an unsized field. Some derives are not usable in this case. 475struct Unsized([u32]); 476#[automatically_derived] 477impl ::core::fmt::Debug for Unsized { 478 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 479 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Unsized", 480 &&self.0) 481 } 482} 483#[automatically_derived] 484impl ::core::hash::Hash for Unsized { 485 #[inline] 486 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 487 ::core::hash::Hash::hash(&self.0, state) 488 } 489} 490#[automatically_derived] 491impl ::core::marker::StructuralPartialEq for Unsized { } 492#[automatically_derived] 493impl ::core::cmp::PartialEq for Unsized { 494 #[inline] 495 fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 } 496} 497#[automatically_derived] 498impl ::core::marker::StructuralEq for Unsized { } 499#[automatically_derived] 500impl ::core::cmp::Eq for Unsized { 501 #[inline] 502 #[doc(hidden)] 503 #[coverage(off)] 504 fn assert_receiver_is_total_eq(&self) -> () { 505 let _: ::core::cmp::AssertParamIsEq<[u32]>; 506 } 507} 508#[automatically_derived] 509impl ::core::cmp::PartialOrd for Unsized { 510 #[inline] 511 fn partial_cmp(&self, other: &Unsized) 512 -> ::core::option::Option<::core::cmp::Ordering> { 513 ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0) 514 } 515} 516#[automatically_derived] 517impl ::core::cmp::Ord for Unsized { 518 #[inline] 519 fn cmp(&self, other: &Unsized) -> ::core::cmp::Ordering { 520 ::core::cmp::Ord::cmp(&self.0, &other.0) 521 } 522} 523 524// A packed struct with an unsized `[u8]` field. This is currently allowed, but 525// causes a warning and will be phased out at some point. 526#[repr(packed)] 527struct PackedUnsizedU8([u8]); 528#[automatically_derived] 529impl ::core::fmt::Debug for PackedUnsizedU8 { 530 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 531 ::core::fmt::Formatter::debug_tuple_field1_finish(f, 532 "PackedUnsizedU8", &&self.0) 533 } 534} 535#[automatically_derived] 536impl ::core::hash::Hash for PackedUnsizedU8 { 537 #[inline] 538 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 539 ::core::hash::Hash::hash(&self.0, state) 540 } 541} 542 543trait Trait { 544 type A; 545} 546 547// A generic struct involving an associated type. 548struct Generic<T: Trait, U> { 549 t: T, 550 ta: T::A, 551 u: U, 552} 553#[automatically_derived] 554impl<T: ::core::clone::Clone + Trait, U: ::core::clone::Clone> 555 ::core::clone::Clone for Generic<T, U> where T::A: ::core::clone::Clone { 556 #[inline] 557 fn clone(&self) -> Generic<T, U> { 558 Generic { 559 t: ::core::clone::Clone::clone(&self.t), 560 ta: ::core::clone::Clone::clone(&self.ta), 561 u: ::core::clone::Clone::clone(&self.u), 562 } 563 } 564} 565#[automatically_derived] 566impl<T: ::core::marker::Copy + Trait, U: ::core::marker::Copy> 567 ::core::marker::Copy for Generic<T, U> where T::A: ::core::marker::Copy { 568} 569#[automatically_derived] 570impl<T: ::core::fmt::Debug + Trait, U: ::core::fmt::Debug> ::core::fmt::Debug 571 for Generic<T, U> where T::A: ::core::fmt::Debug { 572 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 573 ::core::fmt::Formatter::debug_struct_field3_finish(f, "Generic", "t", 574 &self.t, "ta", &self.ta, "u", &&self.u) 575 } 576} 577#[automatically_derived] 578impl<T: ::core::default::Default + Trait, U: ::core::default::Default> 579 ::core::default::Default for Generic<T, U> where 580 T::A: ::core::default::Default { 581 #[inline] 582 fn default() -> Generic<T, U> { 583 Generic { 584 t: ::core::default::Default::default(), 585 ta: ::core::default::Default::default(), 586 u: ::core::default::Default::default(), 587 } 588 } 589} 590#[automatically_derived] 591impl<T: ::core::hash::Hash + Trait, U: ::core::hash::Hash> ::core::hash::Hash 592 for Generic<T, U> where T::A: ::core::hash::Hash { 593 #[inline] 594 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 595 ::core::hash::Hash::hash(&self.t, state); 596 ::core::hash::Hash::hash(&self.ta, state); 597 ::core::hash::Hash::hash(&self.u, state) 598 } 599} 600#[automatically_derived] 601impl<T: Trait, U> ::core::marker::StructuralPartialEq for Generic<T, U> { } 602#[automatically_derived] 603impl<T: ::core::cmp::PartialEq + Trait, U: ::core::cmp::PartialEq> 604 ::core::cmp::PartialEq for Generic<T, U> where 605 T::A: ::core::cmp::PartialEq { 606 #[inline] 607 fn eq(&self, other: &Generic<T, U>) -> bool { 608 self.t == other.t && self.ta == other.ta && self.u == other.u 609 } 610} 611#[automatically_derived] 612impl<T: Trait, U> ::core::marker::StructuralEq for Generic<T, U> { } 613#[automatically_derived] 614impl<T: ::core::cmp::Eq + Trait, U: ::core::cmp::Eq> ::core::cmp::Eq for 615 Generic<T, U> where T::A: ::core::cmp::Eq { 616 #[inline] 617 #[doc(hidden)] 618 #[coverage(off)] 619 fn assert_receiver_is_total_eq(&self) -> () { 620 let _: ::core::cmp::AssertParamIsEq<T>; 621 let _: ::core::cmp::AssertParamIsEq<T::A>; 622 let _: ::core::cmp::AssertParamIsEq<U>; 623 } 624} 625#[automatically_derived] 626impl<T: ::core::cmp::PartialOrd + Trait, U: ::core::cmp::PartialOrd> 627 ::core::cmp::PartialOrd for Generic<T, U> where 628 T::A: ::core::cmp::PartialOrd { 629 #[inline] 630 fn partial_cmp(&self, other: &Generic<T, U>) 631 -> ::core::option::Option<::core::cmp::Ordering> { 632 match ::core::cmp::PartialOrd::partial_cmp(&self.t, &other.t) { 633 ::core::option::Option::Some(::core::cmp::Ordering::Equal) => 634 match ::core::cmp::PartialOrd::partial_cmp(&self.ta, 635 &other.ta) { 636 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 637 => ::core::cmp::PartialOrd::partial_cmp(&self.u, &other.u), 638 cmp => cmp, 639 }, 640 cmp => cmp, 641 } 642 } 643} 644#[automatically_derived] 645impl<T: ::core::cmp::Ord + Trait, U: ::core::cmp::Ord> ::core::cmp::Ord for 646 Generic<T, U> where T::A: ::core::cmp::Ord { 647 #[inline] 648 fn cmp(&self, other: &Generic<T, U>) -> ::core::cmp::Ordering { 649 match ::core::cmp::Ord::cmp(&self.t, &other.t) { 650 ::core::cmp::Ordering::Equal => 651 match ::core::cmp::Ord::cmp(&self.ta, &other.ta) { 652 ::core::cmp::Ordering::Equal => 653 ::core::cmp::Ord::cmp(&self.u, &other.u), 654 cmp => cmp, 655 }, 656 cmp => cmp, 657 } 658 } 659} 660 661// A packed, generic tuple struct involving an associated type. Because it is 662// packed, a `T: Copy` bound is added to all impls (and where clauses within 663// them) except for `Default`. This is because we must access fields using 664// copies (e.g. `&{self.0}`), instead of using direct references (e.g. 665// `&self.0`) which may be misaligned in a packed struct. 666#[repr(packed)] 667struct PackedGeneric<T: Trait, U>(T, T::A, U); 668#[automatically_derived] 669impl<T: ::core::clone::Clone + ::core::marker::Copy + Trait, 670 U: ::core::clone::Clone + ::core::marker::Copy> ::core::clone::Clone for 671 PackedGeneric<T, U> where T::A: ::core::clone::Clone + 672 ::core::marker::Copy { 673 #[inline] 674 fn clone(&self) -> PackedGeneric<T, U> { 675 PackedGeneric(::core::clone::Clone::clone(&{ self.0 }), 676 ::core::clone::Clone::clone(&{ self.1 }), 677 ::core::clone::Clone::clone(&{ self.2 })) 678 } 679} 680#[automatically_derived] 681impl<T: ::core::marker::Copy + Trait, U: ::core::marker::Copy> 682 ::core::marker::Copy for PackedGeneric<T, U> where 683 T::A: ::core::marker::Copy { 684} 685#[automatically_derived] 686impl<T: ::core::fmt::Debug + ::core::marker::Copy + Trait, 687 U: ::core::fmt::Debug + ::core::marker::Copy> ::core::fmt::Debug for 688 PackedGeneric<T, U> where T::A: ::core::fmt::Debug + ::core::marker::Copy 689 { 690 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 691 ::core::fmt::Formatter::debug_tuple_field3_finish(f, "PackedGeneric", 692 &{ self.0 }, &{ self.1 }, &&{ self.2 }) 693 } 694} 695#[automatically_derived] 696impl<T: ::core::default::Default + Trait, U: ::core::default::Default> 697 ::core::default::Default for PackedGeneric<T, U> where 698 T::A: ::core::default::Default { 699 #[inline] 700 fn default() -> PackedGeneric<T, U> { 701 PackedGeneric(::core::default::Default::default(), 702 ::core::default::Default::default(), 703 ::core::default::Default::default()) 704 } 705} 706#[automatically_derived] 707impl<T: ::core::hash::Hash + ::core::marker::Copy + Trait, 708 U: ::core::hash::Hash + ::core::marker::Copy> ::core::hash::Hash for 709 PackedGeneric<T, U> where T::A: ::core::hash::Hash + ::core::marker::Copy 710 { 711 #[inline] 712 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 713 ::core::hash::Hash::hash(&{ self.0 }, state); 714 ::core::hash::Hash::hash(&{ self.1 }, state); 715 ::core::hash::Hash::hash(&{ self.2 }, state) 716 } 717} 718#[automatically_derived] 719impl<T: Trait, U> ::core::marker::StructuralPartialEq for PackedGeneric<T, U> 720 { 721} 722#[automatically_derived] 723impl<T: ::core::cmp::PartialEq + ::core::marker::Copy + Trait, 724 U: ::core::cmp::PartialEq + ::core::marker::Copy> ::core::cmp::PartialEq 725 for PackedGeneric<T, U> where T::A: ::core::cmp::PartialEq + 726 ::core::marker::Copy { 727 #[inline] 728 fn eq(&self, other: &PackedGeneric<T, U>) -> bool { 729 ({ self.0 }) == ({ other.0 }) && ({ self.1 }) == ({ other.1 }) && 730 ({ self.2 }) == ({ other.2 }) 731 } 732} 733#[automatically_derived] 734impl<T: Trait, U> ::core::marker::StructuralEq for PackedGeneric<T, U> { } 735#[automatically_derived] 736impl<T: ::core::cmp::Eq + ::core::marker::Copy + Trait, U: ::core::cmp::Eq + 737 ::core::marker::Copy> ::core::cmp::Eq for PackedGeneric<T, U> where 738 T::A: ::core::cmp::Eq + ::core::marker::Copy { 739 #[inline] 740 #[doc(hidden)] 741 #[coverage(off)] 742 fn assert_receiver_is_total_eq(&self) -> () { 743 let _: ::core::cmp::AssertParamIsEq<T>; 744 let _: ::core::cmp::AssertParamIsEq<T::A>; 745 let _: ::core::cmp::AssertParamIsEq<U>; 746 } 747} 748#[automatically_derived] 749impl<T: ::core::cmp::PartialOrd + ::core::marker::Copy + Trait, 750 U: ::core::cmp::PartialOrd + ::core::marker::Copy> ::core::cmp::PartialOrd 751 for PackedGeneric<T, U> where T::A: ::core::cmp::PartialOrd + 752 ::core::marker::Copy { 753 #[inline] 754 fn partial_cmp(&self, other: &PackedGeneric<T, U>) 755 -> ::core::option::Option<::core::cmp::Ordering> { 756 match ::core::cmp::PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 }) 757 { 758 ::core::option::Option::Some(::core::cmp::Ordering::Equal) => 759 match ::core::cmp::PartialOrd::partial_cmp(&{ self.1 }, 760 &{ other.1 }) { 761 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 762 => 763 ::core::cmp::PartialOrd::partial_cmp(&{ self.2 }, 764 &{ other.2 }), 765 cmp => cmp, 766 }, 767 cmp => cmp, 768 } 769 } 770} 771#[automatically_derived] 772impl<T: ::core::cmp::Ord + ::core::marker::Copy + Trait, U: ::core::cmp::Ord + 773 ::core::marker::Copy> ::core::cmp::Ord for PackedGeneric<T, U> where 774 T::A: ::core::cmp::Ord + ::core::marker::Copy { 775 #[inline] 776 fn cmp(&self, other: &PackedGeneric<T, U>) -> ::core::cmp::Ordering { 777 match ::core::cmp::Ord::cmp(&{ self.0 }, &{ other.0 }) { 778 ::core::cmp::Ordering::Equal => 779 match ::core::cmp::Ord::cmp(&{ self.1 }, &{ other.1 }) { 780 ::core::cmp::Ordering::Equal => 781 ::core::cmp::Ord::cmp(&{ self.2 }, &{ other.2 }), 782 cmp => cmp, 783 }, 784 cmp => cmp, 785 } 786 } 787} 788 789// An empty enum. 790enum Enum0 {} 791#[automatically_derived] 792impl ::core::clone::Clone for Enum0 { 793 #[inline] 794 fn clone(&self) -> Enum0 { *self } 795} 796#[automatically_derived] 797impl ::core::marker::Copy for Enum0 { } 798#[automatically_derived] 799impl ::core::fmt::Debug for Enum0 { 800 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 801 match *self {} 802 } 803} 804#[automatically_derived] 805impl ::core::hash::Hash for Enum0 { 806 #[inline] 807 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 808 match *self {} 809 } 810} 811#[automatically_derived] 812impl ::core::marker::StructuralPartialEq for Enum0 { } 813#[automatically_derived] 814impl ::core::cmp::PartialEq for Enum0 { 815 #[inline] 816 fn eq(&self, other: &Enum0) -> bool { match *self {} } 817} 818#[automatically_derived] 819impl ::core::marker::StructuralEq for Enum0 { } 820#[automatically_derived] 821impl ::core::cmp::Eq for Enum0 { 822 #[inline] 823 #[doc(hidden)] 824 #[coverage(off)] 825 fn assert_receiver_is_total_eq(&self) -> () {} 826} 827#[automatically_derived] 828impl ::core::cmp::PartialOrd for Enum0 { 829 #[inline] 830 fn partial_cmp(&self, other: &Enum0) 831 -> ::core::option::Option<::core::cmp::Ordering> { 832 match *self {} 833 } 834} 835#[automatically_derived] 836impl ::core::cmp::Ord for Enum0 { 837 #[inline] 838 fn cmp(&self, other: &Enum0) -> ::core::cmp::Ordering { match *self {} } 839} 840 841// A single-variant enum. 842enum Enum1 { 843 Single { 844 x: u32, 845 }, 846} 847#[automatically_derived] 848impl ::core::clone::Clone for Enum1 { 849 #[inline] 850 fn clone(&self) -> Enum1 { 851 match self { 852 Enum1::Single { x: __self_0 } => 853 Enum1::Single { x: ::core::clone::Clone::clone(__self_0) }, 854 } 855 } 856} 857#[automatically_derived] 858impl ::core::fmt::Debug for Enum1 { 859 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 860 match self { 861 Enum1::Single { x: __self_0 } => 862 ::core::fmt::Formatter::debug_struct_field1_finish(f, 863 "Single", "x", &__self_0), 864 } 865 } 866} 867#[automatically_derived] 868impl ::core::hash::Hash for Enum1 { 869 #[inline] 870 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 871 match self { 872 Enum1::Single { x: __self_0 } => 873 ::core::hash::Hash::hash(__self_0, state), 874 } 875 } 876} 877#[automatically_derived] 878impl ::core::marker::StructuralPartialEq for Enum1 { } 879#[automatically_derived] 880impl ::core::cmp::PartialEq for Enum1 { 881 #[inline] 882 fn eq(&self, other: &Enum1) -> bool { 883 match (self, other) { 884 (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) => 885 *__self_0 == *__arg1_0, 886 } 887 } 888} 889#[automatically_derived] 890impl ::core::marker::StructuralEq for Enum1 { } 891#[automatically_derived] 892impl ::core::cmp::Eq for Enum1 { 893 #[inline] 894 #[doc(hidden)] 895 #[coverage(off)] 896 fn assert_receiver_is_total_eq(&self) -> () { 897 let _: ::core::cmp::AssertParamIsEq<u32>; 898 } 899} 900#[automatically_derived] 901impl ::core::cmp::PartialOrd for Enum1 { 902 #[inline] 903 fn partial_cmp(&self, other: &Enum1) 904 -> ::core::option::Option<::core::cmp::Ordering> { 905 match (self, other) { 906 (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) => 907 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 908 } 909 } 910} 911#[automatically_derived] 912impl ::core::cmp::Ord for Enum1 { 913 #[inline] 914 fn cmp(&self, other: &Enum1) -> ::core::cmp::Ordering { 915 match (self, other) { 916 (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) => 917 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 918 } 919 } 920} 921 922// A C-like, fieldless enum with a single variant. 923enum Fieldless1 { 924 925 #[default] 926 A, 927} 928#[automatically_derived] 929impl ::core::clone::Clone for Fieldless1 { 930 #[inline] 931 fn clone(&self) -> Fieldless1 { Fieldless1::A } 932} 933#[automatically_derived] 934impl ::core::fmt::Debug for Fieldless1 { 935 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 936 ::core::fmt::Formatter::write_str(f, "A") 937 } 938} 939#[automatically_derived] 940impl ::core::default::Default for Fieldless1 { 941 #[inline] 942 fn default() -> Fieldless1 { Self::A } 943} 944#[automatically_derived] 945impl ::core::hash::Hash for Fieldless1 { 946 #[inline] 947 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {} 948} 949#[automatically_derived] 950impl ::core::marker::StructuralPartialEq for Fieldless1 { } 951#[automatically_derived] 952impl ::core::cmp::PartialEq for Fieldless1 { 953 #[inline] 954 fn eq(&self, other: &Fieldless1) -> bool { true } 955} 956#[automatically_derived] 957impl ::core::marker::StructuralEq for Fieldless1 { } 958#[automatically_derived] 959impl ::core::cmp::Eq for Fieldless1 { 960 #[inline] 961 #[doc(hidden)] 962 #[coverage(off)] 963 fn assert_receiver_is_total_eq(&self) -> () {} 964} 965#[automatically_derived] 966impl ::core::cmp::PartialOrd for Fieldless1 { 967 #[inline] 968 fn partial_cmp(&self, other: &Fieldless1) 969 -> ::core::option::Option<::core::cmp::Ordering> { 970 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 971 } 972} 973#[automatically_derived] 974impl ::core::cmp::Ord for Fieldless1 { 975 #[inline] 976 fn cmp(&self, other: &Fieldless1) -> ::core::cmp::Ordering { 977 ::core::cmp::Ordering::Equal 978 } 979} 980 981// A C-like, fieldless enum. 982enum Fieldless { 983 984 #[default] 985 A, 986 B, 987 C, 988} 989#[automatically_derived] 990impl ::core::clone::Clone for Fieldless { 991 #[inline] 992 fn clone(&self) -> Fieldless { *self } 993} 994#[automatically_derived] 995impl ::core::marker::Copy for Fieldless { } 996#[automatically_derived] 997impl ::core::fmt::Debug for Fieldless { 998 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 999 ::core::fmt::Formatter::write_str(f, 1000 match self { 1001 Fieldless::A => "A", 1002 Fieldless::B => "B", 1003 Fieldless::C => "C", 1004 }) 1005 } 1006} 1007#[automatically_derived] 1008impl ::core::default::Default for Fieldless { 1009 #[inline] 1010 fn default() -> Fieldless { Self::A } 1011} 1012#[automatically_derived] 1013impl ::core::hash::Hash for Fieldless { 1014 #[inline] 1015 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 1016 let __self_tag = ::core::intrinsics::discriminant_value(self); 1017 ::core::hash::Hash::hash(&__self_tag, state) 1018 } 1019} 1020#[automatically_derived] 1021impl ::core::marker::StructuralPartialEq for Fieldless { } 1022#[automatically_derived] 1023impl ::core::cmp::PartialEq for Fieldless { 1024 #[inline] 1025 fn eq(&self, other: &Fieldless) -> bool { 1026 let __self_tag = ::core::intrinsics::discriminant_value(self); 1027 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1028 __self_tag == __arg1_tag 1029 } 1030} 1031#[automatically_derived] 1032impl ::core::marker::StructuralEq for Fieldless { } 1033#[automatically_derived] 1034impl ::core::cmp::Eq for Fieldless { 1035 #[inline] 1036 #[doc(hidden)] 1037 #[coverage(off)] 1038 fn assert_receiver_is_total_eq(&self) -> () {} 1039} 1040#[automatically_derived] 1041impl ::core::cmp::PartialOrd for Fieldless { 1042 #[inline] 1043 fn partial_cmp(&self, other: &Fieldless) 1044 -> ::core::option::Option<::core::cmp::Ordering> { 1045 let __self_tag = ::core::intrinsics::discriminant_value(self); 1046 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1047 ::core::cmp::PartialOrd::partial_cmp(&__self_tag, &__arg1_tag) 1048 } 1049} 1050#[automatically_derived] 1051impl ::core::cmp::Ord for Fieldless { 1052 #[inline] 1053 fn cmp(&self, other: &Fieldless) -> ::core::cmp::Ordering { 1054 let __self_tag = ::core::intrinsics::discriminant_value(self); 1055 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1056 ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) 1057 } 1058} 1059 1060// An enum with multiple fieldless and fielded variants. 1061enum Mixed { 1062 1063 #[default] 1064 P, 1065 Q, 1066 R(u32), 1067 S { 1068 d1: Option<u32>, 1069 d2: Option<i32>, 1070 }, 1071} 1072#[automatically_derived] 1073impl ::core::clone::Clone for Mixed { 1074 #[inline] 1075 fn clone(&self) -> Mixed { 1076 let _: ::core::clone::AssertParamIsClone<u32>; 1077 let _: ::core::clone::AssertParamIsClone<Option<u32>>; 1078 let _: ::core::clone::AssertParamIsClone<Option<i32>>; 1079 *self 1080 } 1081} 1082#[automatically_derived] 1083impl ::core::marker::Copy for Mixed { } 1084#[automatically_derived] 1085impl ::core::fmt::Debug for Mixed { 1086 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 1087 match self { 1088 Mixed::P => ::core::fmt::Formatter::write_str(f, "P"), 1089 Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"), 1090 Mixed::R(__self_0) => 1091 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "R", 1092 &__self_0), 1093 Mixed::S { d1: __self_0, d2: __self_1 } => 1094 ::core::fmt::Formatter::debug_struct_field2_finish(f, "S", 1095 "d1", __self_0, "d2", &__self_1), 1096 } 1097 } 1098} 1099#[automatically_derived] 1100impl ::core::default::Default for Mixed { 1101 #[inline] 1102 fn default() -> Mixed { Self::P } 1103} 1104#[automatically_derived] 1105impl ::core::hash::Hash for Mixed { 1106 #[inline] 1107 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 1108 let __self_tag = ::core::intrinsics::discriminant_value(self); 1109 ::core::hash::Hash::hash(&__self_tag, state); 1110 match self { 1111 Mixed::R(__self_0) => ::core::hash::Hash::hash(__self_0, state), 1112 Mixed::S { d1: __self_0, d2: __self_1 } => { 1113 ::core::hash::Hash::hash(__self_0, state); 1114 ::core::hash::Hash::hash(__self_1, state) 1115 } 1116 _ => {} 1117 } 1118 } 1119} 1120#[automatically_derived] 1121impl ::core::marker::StructuralPartialEq for Mixed { } 1122#[automatically_derived] 1123impl ::core::cmp::PartialEq for Mixed { 1124 #[inline] 1125 fn eq(&self, other: &Mixed) -> bool { 1126 let __self_tag = ::core::intrinsics::discriminant_value(self); 1127 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1128 __self_tag == __arg1_tag && 1129 match (self, other) { 1130 (Mixed::R(__self_0), Mixed::R(__arg1_0)) => 1131 *__self_0 == *__arg1_0, 1132 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { 1133 d1: __arg1_0, d2: __arg1_1 }) => 1134 *__self_0 == *__arg1_0 && *__self_1 == *__arg1_1, 1135 _ => true, 1136 } 1137 } 1138} 1139#[automatically_derived] 1140impl ::core::marker::StructuralEq for Mixed { } 1141#[automatically_derived] 1142impl ::core::cmp::Eq for Mixed { 1143 #[inline] 1144 #[doc(hidden)] 1145 #[coverage(off)] 1146 fn assert_receiver_is_total_eq(&self) -> () { 1147 let _: ::core::cmp::AssertParamIsEq<u32>; 1148 let _: ::core::cmp::AssertParamIsEq<Option<u32>>; 1149 let _: ::core::cmp::AssertParamIsEq<Option<i32>>; 1150 } 1151} 1152#[automatically_derived] 1153impl ::core::cmp::PartialOrd for Mixed { 1154 #[inline] 1155 fn partial_cmp(&self, other: &Mixed) 1156 -> ::core::option::Option<::core::cmp::Ordering> { 1157 let __self_tag = ::core::intrinsics::discriminant_value(self); 1158 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1159 match (self, other) { 1160 (Mixed::R(__self_0), Mixed::R(__arg1_0)) => 1161 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 1162 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { 1163 d1: __arg1_0, d2: __arg1_1 }) => 1164 match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) 1165 { 1166 ::core::option::Option::Some(::core::cmp::Ordering::Equal) 1167 => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), 1168 cmp => cmp, 1169 }, 1170 _ => 1171 ::core::cmp::PartialOrd::partial_cmp(&__self_tag, 1172 &__arg1_tag), 1173 } 1174 } 1175} 1176#[automatically_derived] 1177impl ::core::cmp::Ord for Mixed { 1178 #[inline] 1179 fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering { 1180 let __self_tag = ::core::intrinsics::discriminant_value(self); 1181 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1182 match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) { 1183 ::core::cmp::Ordering::Equal => 1184 match (self, other) { 1185 (Mixed::R(__self_0), Mixed::R(__arg1_0)) => 1186 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 1187 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S { 1188 d1: __arg1_0, d2: __arg1_1 }) => 1189 match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { 1190 ::core::cmp::Ordering::Equal => 1191 ::core::cmp::Ord::cmp(__self_1, __arg1_1), 1192 cmp => cmp, 1193 }, 1194 _ => ::core::cmp::Ordering::Equal, 1195 }, 1196 cmp => cmp, 1197 } 1198 } 1199} 1200 1201// An enum with no fieldless variants. Note that `Default` cannot be derived 1202// for this enum. 1203enum Fielded { X(u32), Y(bool), Z(Option<i32>), } 1204#[automatically_derived] 1205impl ::core::clone::Clone for Fielded { 1206 #[inline] 1207 fn clone(&self) -> Fielded { 1208 match self { 1209 Fielded::X(__self_0) => 1210 Fielded::X(::core::clone::Clone::clone(__self_0)), 1211 Fielded::Y(__self_0) => 1212 Fielded::Y(::core::clone::Clone::clone(__self_0)), 1213 Fielded::Z(__self_0) => 1214 Fielded::Z(::core::clone::Clone::clone(__self_0)), 1215 } 1216 } 1217} 1218#[automatically_derived] 1219impl ::core::fmt::Debug for Fielded { 1220 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 1221 match self { 1222 Fielded::X(__self_0) => 1223 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "X", 1224 &__self_0), 1225 Fielded::Y(__self_0) => 1226 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y", 1227 &__self_0), 1228 Fielded::Z(__self_0) => 1229 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z", 1230 &__self_0), 1231 } 1232 } 1233} 1234#[automatically_derived] 1235impl ::core::hash::Hash for Fielded { 1236 #[inline] 1237 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 1238 let __self_tag = ::core::intrinsics::discriminant_value(self); 1239 ::core::hash::Hash::hash(&__self_tag, state); 1240 match self { 1241 Fielded::X(__self_0) => ::core::hash::Hash::hash(__self_0, state), 1242 Fielded::Y(__self_0) => ::core::hash::Hash::hash(__self_0, state), 1243 Fielded::Z(__self_0) => ::core::hash::Hash::hash(__self_0, state), 1244 } 1245 } 1246} 1247#[automatically_derived] 1248impl ::core::marker::StructuralPartialEq for Fielded { } 1249#[automatically_derived] 1250impl ::core::cmp::PartialEq for Fielded { 1251 #[inline] 1252 fn eq(&self, other: &Fielded) -> bool { 1253 let __self_tag = ::core::intrinsics::discriminant_value(self); 1254 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1255 __self_tag == __arg1_tag && 1256 match (self, other) { 1257 (Fielded::X(__self_0), Fielded::X(__arg1_0)) => 1258 *__self_0 == *__arg1_0, 1259 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => 1260 *__self_0 == *__arg1_0, 1261 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => 1262 *__self_0 == *__arg1_0, 1263 _ => unsafe { ::core::intrinsics::unreachable() } 1264 } 1265 } 1266} 1267#[automatically_derived] 1268impl ::core::marker::StructuralEq for Fielded { } 1269#[automatically_derived] 1270impl ::core::cmp::Eq for Fielded { 1271 #[inline] 1272 #[doc(hidden)] 1273 #[coverage(off)] 1274 fn assert_receiver_is_total_eq(&self) -> () { 1275 let _: ::core::cmp::AssertParamIsEq<u32>; 1276 let _: ::core::cmp::AssertParamIsEq<bool>; 1277 let _: ::core::cmp::AssertParamIsEq<Option<i32>>; 1278 } 1279} 1280#[automatically_derived] 1281impl ::core::cmp::PartialOrd for Fielded { 1282 #[inline] 1283 fn partial_cmp(&self, other: &Fielded) 1284 -> ::core::option::Option<::core::cmp::Ordering> { 1285 let __self_tag = ::core::intrinsics::discriminant_value(self); 1286 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1287 match (self, other) { 1288 (Fielded::X(__self_0), Fielded::X(__arg1_0)) => 1289 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 1290 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => 1291 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 1292 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => 1293 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 1294 _ => 1295 ::core::cmp::PartialOrd::partial_cmp(&__self_tag, 1296 &__arg1_tag), 1297 } 1298 } 1299} 1300#[automatically_derived] 1301impl ::core::cmp::Ord for Fielded { 1302 #[inline] 1303 fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering { 1304 let __self_tag = ::core::intrinsics::discriminant_value(self); 1305 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1306 match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) { 1307 ::core::cmp::Ordering::Equal => 1308 match (self, other) { 1309 (Fielded::X(__self_0), Fielded::X(__arg1_0)) => 1310 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 1311 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) => 1312 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 1313 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) => 1314 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 1315 _ => unsafe { ::core::intrinsics::unreachable() } 1316 }, 1317 cmp => cmp, 1318 } 1319 } 1320} 1321 1322// A generic enum. Note that `Default` cannot be derived for this enum. 1323enum EnumGeneric<T, U> { One(T), Two(U), } 1324#[automatically_derived] 1325impl<T: ::core::clone::Clone, U: ::core::clone::Clone> ::core::clone::Clone 1326 for EnumGeneric<T, U> { 1327 #[inline] 1328 fn clone(&self) -> EnumGeneric<T, U> { 1329 match self { 1330 EnumGeneric::One(__self_0) => 1331 EnumGeneric::One(::core::clone::Clone::clone(__self_0)), 1332 EnumGeneric::Two(__self_0) => 1333 EnumGeneric::Two(::core::clone::Clone::clone(__self_0)), 1334 } 1335 } 1336} 1337#[automatically_derived] 1338impl<T: ::core::marker::Copy, U: ::core::marker::Copy> ::core::marker::Copy 1339 for EnumGeneric<T, U> { 1340} 1341#[automatically_derived] 1342impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for 1343 EnumGeneric<T, U> { 1344 fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { 1345 match self { 1346 EnumGeneric::One(__self_0) => 1347 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "One", 1348 &__self_0), 1349 EnumGeneric::Two(__self_0) => 1350 ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Two", 1351 &__self_0), 1352 } 1353 } 1354} 1355#[automatically_derived] 1356impl<T: ::core::hash::Hash, U: ::core::hash::Hash> ::core::hash::Hash for 1357 EnumGeneric<T, U> { 1358 #[inline] 1359 fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { 1360 let __self_tag = ::core::intrinsics::discriminant_value(self); 1361 ::core::hash::Hash::hash(&__self_tag, state); 1362 match self { 1363 EnumGeneric::One(__self_0) => 1364 ::core::hash::Hash::hash(__self_0, state), 1365 EnumGeneric::Two(__self_0) => 1366 ::core::hash::Hash::hash(__self_0, state), 1367 } 1368 } 1369} 1370#[automatically_derived] 1371impl<T, U> ::core::marker::StructuralPartialEq for EnumGeneric<T, U> { } 1372#[automatically_derived] 1373impl<T: ::core::cmp::PartialEq, U: ::core::cmp::PartialEq> 1374 ::core::cmp::PartialEq for EnumGeneric<T, U> { 1375 #[inline] 1376 fn eq(&self, other: &EnumGeneric<T, U>) -> bool { 1377 let __self_tag = ::core::intrinsics::discriminant_value(self); 1378 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1379 __self_tag == __arg1_tag && 1380 match (self, other) { 1381 (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => 1382 *__self_0 == *__arg1_0, 1383 (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => 1384 *__self_0 == *__arg1_0, 1385 _ => unsafe { ::core::intrinsics::unreachable() } 1386 } 1387 } 1388} 1389#[automatically_derived] 1390impl<T, U> ::core::marker::StructuralEq for EnumGeneric<T, U> { } 1391#[automatically_derived] 1392impl<T: ::core::cmp::Eq, U: ::core::cmp::Eq> ::core::cmp::Eq for 1393 EnumGeneric<T, U> { 1394 #[inline] 1395 #[doc(hidden)] 1396 #[coverage(off)] 1397 fn assert_receiver_is_total_eq(&self) -> () { 1398 let _: ::core::cmp::AssertParamIsEq<T>; 1399 let _: ::core::cmp::AssertParamIsEq<U>; 1400 } 1401} 1402#[automatically_derived] 1403impl<T: ::core::cmp::PartialOrd, U: ::core::cmp::PartialOrd> 1404 ::core::cmp::PartialOrd for EnumGeneric<T, U> { 1405 #[inline] 1406 fn partial_cmp(&self, other: &EnumGeneric<T, U>) 1407 -> ::core::option::Option<::core::cmp::Ordering> { 1408 let __self_tag = ::core::intrinsics::discriminant_value(self); 1409 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1410 match (self, other) { 1411 (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => 1412 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 1413 (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => 1414 ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), 1415 _ => 1416 ::core::cmp::PartialOrd::partial_cmp(&__self_tag, 1417 &__arg1_tag), 1418 } 1419 } 1420} 1421#[automatically_derived] 1422impl<T: ::core::cmp::Ord, U: ::core::cmp::Ord> ::core::cmp::Ord for 1423 EnumGeneric<T, U> { 1424 #[inline] 1425 fn cmp(&self, other: &EnumGeneric<T, U>) -> ::core::cmp::Ordering { 1426 let __self_tag = ::core::intrinsics::discriminant_value(self); 1427 let __arg1_tag = ::core::intrinsics::discriminant_value(other); 1428 match ::core::cmp::Ord::cmp(&__self_tag, &__arg1_tag) { 1429 ::core::cmp::Ordering::Equal => 1430 match (self, other) { 1431 (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) => 1432 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 1433 (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) => 1434 ::core::cmp::Ord::cmp(__self_0, __arg1_0), 1435 _ => unsafe { ::core::intrinsics::unreachable() } 1436 }, 1437 cmp => cmp, 1438 } 1439 } 1440} 1441 1442// A union. Most builtin traits are not derivable for unions. 1443pub union Union { 1444 pub b: bool, 1445 pub u: u32, 1446 pub i: i32, 1447} 1448#[automatically_derived] 1449impl ::core::clone::Clone for Union { 1450 #[inline] 1451 fn clone(&self) -> Union { 1452 let _: ::core::clone::AssertParamIsCopy<Self>; 1453 *self 1454 } 1455} 1456#[automatically_derived] 1457impl ::core::marker::Copy for Union { }