Auto merge of #98758 - nnethercote:more-derive-output-improvements, r=Mark-Simulacrum

More derive output improvements

This PR includes:
- Some test improvements.
- Some cosmetic changes to derive output that make the code look more like what a human would write.
- Some more fundamental improvements to `cmp` and `partial_cmp` generation.

r? `@Mark-Simulacrum`
This commit is contained in:
bors
2022-07-08 12:44:14 +00:00
15 changed files with 655 additions and 568 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
// CHECK: @STATIC = {{.*}}, align 4
// This checks the constants from inline_enum_const
// CHECK: @alloc14 = {{.*}}, align 2
// CHECK: @alloc12 = {{.*}}, align 2
// This checks the constants from {low,high}_align_const, they share the same
// constant, but the alignment differs, so the higher one should be used
@@ -39,6 +39,16 @@ struct Big {
#[repr(packed)]
struct Packed(u32);
// An empty enum.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Enum0 {}
// A single-variant enum.
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Enum1 {
Single { x: u32 }
}
// A C-like, fieldless enum.
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Fieldless {
@@ -66,3 +76,11 @@ enum Fielded {
Y(bool),
Z(Option<i32>),
}
// A union. Most builtin traits are not derivable for unions.
#[derive(Clone, Copy)]
pub union Union {
pub b: bool,
pub u: u32,
pub i: i32,
}
+394 -361
View File
@@ -28,7 +28,7 @@ struct Empty;
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Empty {
#[inline]
fn clone(&self) -> Empty { { *self } }
fn clone(&self) -> Empty { *self }
}
#[automatically_derived]
#[allow(unused_qualifications)]
@@ -49,7 +49,7 @@ impl ::core::default::Default for Empty {
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Empty {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { {} }
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {}
}
impl ::core::marker::StructuralPartialEq for Empty {}
#[automatically_derived]
@@ -65,7 +65,7 @@ impl ::core::cmp::Eq for Empty {
#[inline]
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () { {} }
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
#[allow(unused_qualifications)]
@@ -95,11 +95,8 @@ struct Point {
impl ::core::clone::Clone for Point {
#[inline]
fn clone(&self) -> Point {
{
let _: ::core::clone::AssertParamIsClone<u32>;
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}
#[automatically_derived]
@@ -128,10 +125,8 @@ impl ::core::default::Default for Point {
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Point {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
{
::core::hash::Hash::hash(&self.x, state);
::core::hash::Hash::hash(&self.y, state)
}
::core::hash::Hash::hash(&self.x, state);
::core::hash::Hash::hash(&self.y, state)
}
}
impl ::core::marker::StructuralPartialEq for Point {}
@@ -155,10 +150,7 @@ impl ::core::cmp::Eq for Point {
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
{
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
}
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}
#[automatically_derived]
@@ -169,13 +161,7 @@ impl ::core::cmp::PartialOrd for Point {
-> ::core::option::Option<::core::cmp::Ordering> {
match ::core::cmp::PartialOrd::partial_cmp(&self.x, &other.x) {
::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
match ::core::cmp::PartialOrd::partial_cmp(&self.y, &other.y)
{
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
::core::cmp::PartialOrd::partial_cmp(&self.y, &other.y),
cmp => cmp,
}
}
@@ -187,11 +173,7 @@ impl ::core::cmp::Ord for Point {
fn cmp(&self, other: &Point) -> ::core::cmp::Ordering {
match ::core::cmp::Ord::cmp(&self.x, &other.x) {
::core::cmp::Ordering::Equal =>
match ::core::cmp::Ord::cmp(&self.y, &other.y) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
::core::cmp::Ord::cmp(&self.y, &other.y),
cmp => cmp,
}
}
@@ -229,15 +211,13 @@ impl ::core::clone::Clone for Big {
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Big {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
{
let names: &'static _ =
&["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"];
let values: &[&dyn ::core::fmt::Debug] =
&[&&self.b1, &&self.b2, &&self.b3, &&self.b4, &&self.b5,
&&self.b6, &&self.b7, &&self.b8];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Big",
names, values)
}
let names: &'static _ =
&["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"];
let values: &[&dyn ::core::fmt::Debug] =
&[&&self.b1, &&self.b2, &&self.b3, &&self.b4, &&self.b5,
&&self.b6, &&self.b7, &&self.b8];
::core::fmt::Formatter::debug_struct_fields_finish(f, "Big", names,
values)
}
}
#[automatically_derived]
@@ -261,16 +241,14 @@ impl ::core::default::Default for Big {
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Big {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
{
::core::hash::Hash::hash(&self.b1, state);
::core::hash::Hash::hash(&self.b2, state);
::core::hash::Hash::hash(&self.b3, state);
::core::hash::Hash::hash(&self.b4, state);
::core::hash::Hash::hash(&self.b5, state);
::core::hash::Hash::hash(&self.b6, state);
::core::hash::Hash::hash(&self.b7, state);
::core::hash::Hash::hash(&self.b8, state)
}
::core::hash::Hash::hash(&self.b1, state);
::core::hash::Hash::hash(&self.b2, state);
::core::hash::Hash::hash(&self.b3, state);
::core::hash::Hash::hash(&self.b4, state);
::core::hash::Hash::hash(&self.b5, state);
::core::hash::Hash::hash(&self.b6, state);
::core::hash::Hash::hash(&self.b7, state);
::core::hash::Hash::hash(&self.b8, state)
}
}
impl ::core::marker::StructuralPartialEq for Big {}
@@ -300,16 +278,7 @@ impl ::core::cmp::Eq for Big {
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
{
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
}
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}
#[automatically_derived]
@@ -344,13 +313,7 @@ impl ::core::cmp::PartialOrd for Big {
&other.b7) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
match ::core::cmp::PartialOrd::partial_cmp(&self.b8,
&other.b8) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
::core::cmp::PartialOrd::partial_cmp(&self.b8, &other.b8),
cmp => cmp,
},
cmp => cmp,
@@ -386,11 +349,7 @@ impl ::core::cmp::Ord for Big {
::core::cmp::Ordering::Equal =>
match ::core::cmp::Ord::cmp(&self.b7, &other.b7) {
::core::cmp::Ordering::Equal =>
match ::core::cmp::Ord::cmp(&self.b8, &other.b8) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
::core::cmp::Ord::cmp(&self.b8, &other.b8),
cmp => cmp,
},
cmp => cmp,
@@ -416,7 +375,8 @@ struct Packed(u32);
impl ::core::clone::Clone for Packed {
#[inline]
fn clone(&self) -> Packed {
{ let _: ::core::clone::AssertParamIsClone<u32>; *self }
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}
#[automatically_derived]
@@ -426,11 +386,9 @@ impl ::core::marker::Copy for Packed { }
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Packed {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
{
let Self(__self_0_0) = *self;
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Packed",
&&__self_0_0)
}
let Self(__self_0_0) = *self;
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Packed",
&&__self_0_0)
}
}
#[automatically_derived]
@@ -443,10 +401,8 @@ impl ::core::default::Default for Packed {
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Packed {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
{
let Self(__self_0_0) = *self;
{ ::core::hash::Hash::hash(&__self_0_0, state) }
}
let Self(__self_0_0) = *self;
::core::hash::Hash::hash(&__self_0_0, state)
}
}
impl ::core::marker::StructuralPartialEq for Packed {}
@@ -455,19 +411,15 @@ impl ::core::marker::StructuralPartialEq for Packed {}
impl ::core::cmp::PartialEq for Packed {
#[inline]
fn eq(&self, other: &Packed) -> bool {
{
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
__self_0_0 == __self_1_0
}
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
__self_0_0 == __self_1_0
}
#[inline]
fn ne(&self, other: &Packed) -> bool {
{
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
__self_0_0 != __self_1_0
}
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
__self_0_0 != __self_1_0
}
}
impl ::core::marker::StructuralEq for Packed {}
@@ -478,7 +430,7 @@ impl ::core::cmp::Eq for Packed {
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
{ let _: ::core::cmp::AssertParamIsEq<u32>; }
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}
#[automatically_derived]
@@ -487,16 +439,9 @@ impl ::core::cmp::PartialOrd for Packed {
#[inline]
fn partial_cmp(&self, other: &Packed)
-> ::core::option::Option<::core::cmp::Ordering> {
{
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
match ::core::cmp::PartialOrd::partial_cmp(&__self_0_0,
&__self_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
}
}
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
::core::cmp::PartialOrd::partial_cmp(&__self_0_0, &__self_1_0)
}
}
#[automatically_derived]
@@ -504,16 +449,167 @@ impl ::core::cmp::PartialOrd for Packed {
impl ::core::cmp::Ord for Packed {
#[inline]
fn cmp(&self, other: &Packed) -> ::core::cmp::Ordering {
{
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
match ::core::cmp::Ord::cmp(&__self_0_0, &__self_1_0) {
::core::cmp::Ordering::Equal => ::core::cmp::Ordering::Equal,
cmp => cmp,
let Self(__self_0_0) = *self;
let Self(__self_1_0) = *other;
::core::cmp::Ord::cmp(&__self_0_0, &__self_1_0)
}
}
// An empty enum.
enum Enum0 {}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Enum0 {
#[inline]
fn clone(&self) -> Enum0 { *self }
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::marker::Copy for Enum0 { }
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Enum0 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
unsafe { ::core::intrinsics::unreachable() }
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Enum0 {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
unsafe { ::core::intrinsics::unreachable() }
}
}
impl ::core::marker::StructuralPartialEq for Enum0 {}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::PartialEq for Enum0 {
#[inline]
fn eq(&self, other: &Enum0) -> bool {
unsafe { ::core::intrinsics::unreachable() }
}
}
impl ::core::marker::StructuralEq for Enum0 {}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::Eq for Enum0 {
#[inline]
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::PartialOrd for Enum0 {
#[inline]
fn partial_cmp(&self, other: &Enum0)
-> ::core::option::Option<::core::cmp::Ordering> {
unsafe { ::core::intrinsics::unreachable() }
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::Ord for Enum0 {
#[inline]
fn cmp(&self, other: &Enum0) -> ::core::cmp::Ordering {
unsafe { ::core::intrinsics::unreachable() }
}
}
// A single-variant enum.
enum Enum1 {
Single {
x: u32,
},
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Enum1 {
#[inline]
fn clone(&self) -> Enum1 {
match &*self {
&Enum1::Single { x: ref __self_0 } =>
Enum1::Single { x: ::core::clone::Clone::clone(&*__self_0) },
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Enum1 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match &*self {
&Enum1::Single { x: ref __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"Single", "x", &&*__self_0),
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Enum1 {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
match &*self {
&Enum1::Single { x: ref __self_0 } => {
::core::hash::Hash::hash(&*__self_0, state)
}
}
}
}
impl ::core::marker::StructuralPartialEq for Enum1 {}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::PartialEq for Enum1 {
#[inline]
fn eq(&self, other: &Enum1) -> bool {
match (&*self, &*other) {
(&Enum1::Single { x: ref __self_0 }, &Enum1::Single {
x: ref __arg_1_0 }) => *__self_0 == *__arg_1_0,
}
}
#[inline]
fn ne(&self, other: &Enum1) -> bool {
match (&*self, &*other) {
(&Enum1::Single { x: ref __self_0 }, &Enum1::Single {
x: ref __arg_1_0 }) => *__self_0 != *__arg_1_0,
}
}
}
impl ::core::marker::StructuralEq for Enum1 {}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::Eq for Enum1 {
#[inline]
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::PartialOrd for Enum1 {
#[inline]
fn partial_cmp(&self, other: &Enum1)
-> ::core::option::Option<::core::cmp::Ordering> {
match (&*self, &*other) {
(&Enum1::Single { x: ref __self_0 }, &Enum1::Single {
x: ref __arg_1_0 }) =>
::core::cmp::PartialOrd::partial_cmp(&*__self_0, &*__arg_1_0),
}
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::cmp::Ord for Enum1 {
#[inline]
fn cmp(&self, other: &Enum1) -> ::core::cmp::Ordering {
match (&*self, &*other) {
(&Enum1::Single { x: ref __self_0 }, &Enum1::Single {
x: ref __arg_1_0 }) =>
::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0),
}
}
}
// A C-like, fieldless enum.
enum Fieldless {
@@ -527,7 +623,7 @@ enum Fieldless {
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Fieldless {
#[inline]
fn clone(&self) -> Fieldless { { *self } }
fn clone(&self) -> Fieldless { *self }
}
#[automatically_derived]
#[allow(unused_qualifications)]
@@ -536,10 +632,10 @@ impl ::core::marker::Copy for Fieldless { }
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Fieldless {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match (&*self,) {
(&Fieldless::A,) => ::core::fmt::Formatter::write_str(f, "A"),
(&Fieldless::B,) => ::core::fmt::Formatter::write_str(f, "B"),
(&Fieldless::C,) => ::core::fmt::Formatter::write_str(f, "C"),
match &*self {
&Fieldless::A => ::core::fmt::Formatter::write_str(f, "A"),
&Fieldless::B => ::core::fmt::Formatter::write_str(f, "B"),
&Fieldless::C => ::core::fmt::Formatter::write_str(f, "C"),
}
}
}
@@ -553,7 +649,7 @@ impl ::core::default::Default for Fieldless {
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Fieldless {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
match (&*self,) {
match &*self {
_ => {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
@@ -567,13 +663,11 @@ impl ::core::marker::StructuralPartialEq for Fieldless {}
impl ::core::cmp::PartialEq for Fieldless {
#[inline]
fn eq(&self, other: &Fieldless) -> bool {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) { _ => true, }
} else { false }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) { _ => true, }
} else { false }
}
}
impl ::core::marker::StructuralEq for Fieldless {}
@@ -583,7 +677,7 @@ impl ::core::cmp::Eq for Fieldless {
#[inline]
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () { {} }
fn assert_receiver_is_total_eq(&self) -> () {}
}
#[automatically_derived]
#[allow(unused_qualifications)]
@@ -591,19 +685,16 @@ impl ::core::cmp::PartialOrd for Fieldless {
#[inline]
fn partial_cmp(&self, other: &Fieldless)
-> ::core::option::Option<::core::cmp::Ordering> {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
_ =>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
}
} else {
::core::cmp::PartialOrd::partial_cmp(&__self_vi,
&__arg_1_vi)
}
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
_ =>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
}
} else {
::core::cmp::PartialOrd::partial_cmp(&__self_vi, &__arg_1_vi)
}
}
}
#[automatically_derived]
@@ -611,15 +702,11 @@ impl ::core::cmp::PartialOrd for Fieldless {
impl ::core::cmp::Ord for Fieldless {
#[inline]
fn cmp(&self, other: &Fieldless) -> ::core::cmp::Ordering {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
_ => ::core::cmp::Ordering::Equal,
}
} else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) { _ => ::core::cmp::Ordering::Equal, }
} else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) }
}
}
@@ -640,12 +727,8 @@ enum Mixed {
impl ::core::clone::Clone for Mixed {
#[inline]
fn clone(&self) -> Mixed {
{
let _: ::core::clone::AssertParamIsClone<u32>;
let _: ::core::clone::AssertParamIsClone<u32>;
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}
#[automatically_derived]
@@ -655,13 +738,13 @@ impl ::core::marker::Copy for Mixed { }
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Mixed {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match (&*self,) {
(&Mixed::P,) => ::core::fmt::Formatter::write_str(f, "P"),
(&Mixed::Q,) => ::core::fmt::Formatter::write_str(f, "Q"),
(&Mixed::R(ref __self_0),) =>
match &*self {
&Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
&Mixed::Q => ::core::fmt::Formatter::write_str(f, "Q"),
&Mixed::R(ref __self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "R",
&&*__self_0),
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },) =>
&Mixed::S { d1: ref __self_0, d2: ref __self_1 } =>
::core::fmt::Formatter::debug_struct_field2_finish(f, "S",
"d1", &&*__self_0, "d2", &&*__self_1),
}
@@ -677,13 +760,13 @@ impl ::core::default::Default for Mixed {
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Mixed {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
match (&*self,) {
(&Mixed::R(ref __self_0),) => {
match &*self {
&Mixed::R(ref __self_0) => {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
::core::hash::Hash::hash(&*__self_0, state)
}
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },) => {
&Mixed::S { d1: ref __self_0, d2: ref __self_1 } => {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
::core::hash::Hash::hash(&*__self_0, state);
@@ -702,37 +785,33 @@ impl ::core::marker::StructuralPartialEq for Mixed {}
impl ::core::cmp::PartialEq for Mixed {
#[inline]
fn eq(&self, other: &Mixed) -> bool {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
*__self_0 == *__arg_1_0 && *__self_1 == *__arg_1_1,
_ => true,
}
} else { false }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
*__self_0 == *__arg_1_0 && *__self_1 == *__arg_1_1,
_ => true,
}
} else { false }
}
#[inline]
fn ne(&self, other: &Mixed) -> bool {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
*__self_0 != *__arg_1_0 || *__self_1 != *__arg_1_1,
_ => false,
}
} else { true }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
*__self_0 != *__arg_1_0 || *__self_1 != *__arg_1_1,
_ => false,
}
} else { true }
}
}
impl ::core::marker::StructuralEq for Mixed {}
@@ -743,11 +822,7 @@ impl ::core::cmp::Eq for Mixed {
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
{
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<u32>;
}
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}
#[automatically_derived]
@@ -756,42 +831,29 @@ impl ::core::cmp::PartialOrd for Mixed {
#[inline]
fn partial_cmp(&self, other: &Mixed)
-> ::core::option::Option<::core::cmp::Ordering> {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_1,
&*__arg_1_1) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
cmp => cmp,
},
_ =>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
}
} else {
::core::cmp::PartialOrd::partial_cmp(&__self_vi,
&__arg_1_vi)
}
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0),
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::cmp::PartialOrd::partial_cmp(&*__self_1,
&*__arg_1_1),
cmp => cmp,
},
_ =>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
}
} else {
::core::cmp::PartialOrd::partial_cmp(&__self_vi, &__arg_1_vi)
}
}
}
#[automatically_derived]
@@ -799,32 +861,22 @@ impl ::core::cmp::PartialOrd for Mixed {
impl ::core::cmp::Ord for Mixed {
#[inline]
fn cmp(&self, other: &Mixed) -> ::core::cmp::Ordering {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
match ::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
match ::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0) {
::core::cmp::Ordering::Equal =>
match ::core::cmp::Ord::cmp(&*__self_1, &*__arg_1_1) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
cmp => cmp,
},
_ => ::core::cmp::Ordering::Equal,
}
} else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Mixed::R(ref __self_0), &Mixed::R(ref __arg_1_0)) =>
::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0),
(&Mixed::S { d1: ref __self_0, d2: ref __self_1 },
&Mixed::S { d1: ref __arg_1_0, d2: ref __arg_1_1 }) =>
match ::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ord::cmp(&*__self_1, &*__arg_1_1),
cmp => cmp,
},
_ => ::core::cmp::Ordering::Equal,
}
} else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) }
}
}
@@ -836,12 +888,12 @@ enum Fielded { X(u32), Y(bool), Z(Option<i32>), }
impl ::core::clone::Clone for Fielded {
#[inline]
fn clone(&self) -> Fielded {
match (&*self,) {
(&Fielded::X(ref __self_0),) =>
match &*self {
&Fielded::X(ref __self_0) =>
Fielded::X(::core::clone::Clone::clone(&*__self_0)),
(&Fielded::Y(ref __self_0),) =>
&Fielded::Y(ref __self_0) =>
Fielded::Y(::core::clone::Clone::clone(&*__self_0)),
(&Fielded::Z(ref __self_0),) =>
&Fielded::Z(ref __self_0) =>
Fielded::Z(::core::clone::Clone::clone(&*__self_0)),
}
}
@@ -850,14 +902,14 @@ impl ::core::clone::Clone for Fielded {
#[allow(unused_qualifications)]
impl ::core::fmt::Debug for Fielded {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match (&*self,) {
(&Fielded::X(ref __self_0),) =>
match &*self {
&Fielded::X(ref __self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "X",
&&*__self_0),
(&Fielded::Y(ref __self_0),) =>
&Fielded::Y(ref __self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Y",
&&*__self_0),
(&Fielded::Z(ref __self_0),) =>
&Fielded::Z(ref __self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Z",
&&*__self_0),
}
@@ -867,18 +919,18 @@ impl ::core::fmt::Debug for Fielded {
#[allow(unused_qualifications)]
impl ::core::hash::Hash for Fielded {
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
match (&*self,) {
(&Fielded::X(ref __self_0),) => {
match &*self {
&Fielded::X(ref __self_0) => {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
::core::hash::Hash::hash(&*__self_0, state)
}
(&Fielded::Y(ref __self_0),) => {
&Fielded::Y(ref __self_0) => {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
::core::hash::Hash::hash(&*__self_0, state)
}
(&Fielded::Z(ref __self_0),) => {
&Fielded::Z(ref __self_0) => {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state);
::core::hash::Hash::hash(&*__self_0, state)
@@ -892,39 +944,35 @@ impl ::core::marker::StructuralPartialEq for Fielded {}
impl ::core::cmp::PartialEq for Fielded {
#[inline]
fn eq(&self, other: &Fielded) -> bool {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else { false }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
*__self_0 == *__arg_1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else { false }
}
#[inline]
fn ne(&self, other: &Fielded) -> bool {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else { true }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
*__self_0 != *__arg_1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else { true }
}
}
impl ::core::marker::StructuralEq for Fielded {}
@@ -935,11 +983,9 @@ impl ::core::cmp::Eq for Fielded {
#[doc(hidden)]
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
{
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
}
let _: ::core::cmp::AssertParamIsEq<u32>;
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
}
}
#[automatically_derived]
@@ -948,42 +994,24 @@ impl ::core::cmp::PartialOrd for Fielded {
#[inline]
fn partial_cmp(&self, other: &Fielded)
-> ::core::option::Option<::core::cmp::Ordering> {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
match ::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0) {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
=>
::core::option::Option::Some(::core::cmp::Ordering::Equal),
cmp => cmp,
},
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else {
::core::cmp::PartialOrd::partial_cmp(&__self_vi,
&__arg_1_vi)
}
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0),
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0),
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
::core::cmp::PartialOrd::partial_cmp(&*__self_0,
&*__arg_1_0),
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else {
::core::cmp::PartialOrd::partial_cmp(&__self_vi, &__arg_1_vi)
}
}
}
#[automatically_derived]
@@ -991,32 +1019,37 @@ impl ::core::cmp::PartialOrd for Fielded {
impl ::core::cmp::Ord for Fielded {
#[inline]
fn cmp(&self, other: &Fielded) -> ::core::cmp::Ordering {
{
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
match ::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
match ::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
match ::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0) {
::core::cmp::Ordering::Equal =>
::core::cmp::Ordering::Equal,
cmp => cmp,
},
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) }
}
let __self_vi = ::core::intrinsics::discriminant_value(&*self);
let __arg_1_vi = ::core::intrinsics::discriminant_value(&*other);
if __self_vi == __arg_1_vi {
match (&*self, &*other) {
(&Fielded::X(ref __self_0), &Fielded::X(ref __arg_1_0)) =>
::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0),
(&Fielded::Y(ref __self_0), &Fielded::Y(ref __arg_1_0)) =>
::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0),
(&Fielded::Z(ref __self_0), &Fielded::Z(ref __arg_1_0)) =>
::core::cmp::Ord::cmp(&*__self_0, &*__arg_1_0),
_ => unsafe { ::core::intrinsics::unreachable() }
}
} else { ::core::cmp::Ord::cmp(&__self_vi, &__arg_1_vi) }
}
}
// A union. Most builtin traits are not derivable for unions.
pub union Union {
pub b: bool,
pub u: u32,
pub i: i32,
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::clone::Clone for Union {
#[inline]
fn clone(&self) -> Union {
let _: ::core::clone::AssertParamIsCopy<Self>;
*self
}
}
#[automatically_derived]
#[allow(unused_qualifications)]
impl ::core::marker::Copy for Union { }