about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-06-24 14:06:35 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-07-04 10:48:15 +1000
commit18f84956772a66293ed91d911ff9e56a269dc685 (patch)
treec41a7d00df53df89f455ab4246687c1d749d69c7
parent46b8c23f3eb5e4d0e0aa27eb3f20d5b8fc3ed51f (diff)
downloadrust-18f84956772a66293ed91d911ff9e56a269dc685.tar.gz
rust-18f84956772a66293ed91d911ff9e56a269dc685.zip
Add an interesting case to the `deriving-all-codegen.rs` test.
-rw-r--r--src/test/ui/deriving/deriving-all-codegen.rs7
-rw-r--r--src/test/ui/deriving/deriving-all-codegen.stdout109
2 files changed, 114 insertions, 2 deletions
diff --git a/src/test/ui/deriving/deriving-all-codegen.rs b/src/test/ui/deriving/deriving-all-codegen.rs
index 2f6ef74ac49..028ed9c2305 100644
--- a/src/test/ui/deriving/deriving-all-codegen.rs
+++ b/src/test/ui/deriving/deriving-all-codegen.rs
@@ -28,12 +28,17 @@ struct Point {
     y: u32,
 }
 
-// A long struct.
+// A large struct.
 #[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
 struct Big {
     b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8:u32,
 }
 
+// A packed tuple struct.
+#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
+#[repr(packed)]
+struct Packed(u32);
+
 // A C-like, fieldless enum.
 #[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
 enum Fieldless {
diff --git a/src/test/ui/deriving/deriving-all-codegen.stdout b/src/test/ui/deriving/deriving-all-codegen.stdout
index faa5a3c3ddf..7635a479257 100644
--- a/src/test/ui/deriving/deriving-all-codegen.stdout
+++ b/src/test/ui/deriving/deriving-all-codegen.stdout
@@ -244,7 +244,7 @@ impl ::core::cmp::Ord for Point {
     }
 }
 
-// A long struct.
+// A large struct.
 struct Big {
     b1: u32,
     b2: u32,
@@ -593,6 +593,113 @@ impl ::core::cmp::Ord for Big {
     }
 }
 
+// A packed tuple struct.
+#[repr(packed)]
+struct Packed(u32);
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::clone::Clone for Packed {
+    #[inline]
+    fn clone(&self) -> Packed {
+        { let _: ::core::clone::AssertParamIsClone<u32>; *self }
+    }
+}
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::marker::Copy for Packed { }
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::fmt::Debug for Packed {
+    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
+        match *self {
+            Self(__self_0_0) =>
+                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Packed",
+                    &&(__self_0_0)),
+        }
+    }
+}
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::default::Default for Packed {
+    #[inline]
+    fn default() -> Packed { Packed(::core::default::Default::default()) }
+}
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::hash::Hash for Packed {
+    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
+        match *self {
+            Self(__self_0_0) => {
+                ::core::hash::Hash::hash(&(__self_0_0), state)
+            }
+        }
+    }
+}
+impl ::core::marker::StructuralPartialEq for Packed {}
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::cmp::PartialEq for Packed {
+    #[inline]
+    fn eq(&self, other: &Packed) -> bool {
+        match *other {
+            Self(__self_1_0) =>
+                match *self {
+                    Self(__self_0_0) => (__self_0_0) == (__self_1_0),
+                },
+        }
+    }
+}
+impl ::core::marker::StructuralEq for Packed {}
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::cmp::Eq for Packed {
+    #[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 Packed {
+    #[inline]
+    fn partial_cmp(&self, other: &Packed)
+        -> ::core::option::Option<::core::cmp::Ordering> {
+        match *other {
+            Self(__self_1_0) =>
+                match *self {
+                    Self(__self_0_0) =>
+                        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,
+                        },
+                },
+        }
+    }
+}
+#[automatically_derived]
+#[allow(unused_qualifications)]
+impl ::core::cmp::Ord for Packed {
+    #[inline]
+    fn cmp(&self, other: &Packed) -> ::core::cmp::Ordering {
+        match *other {
+            Self(__self_1_0) =>
+                match *self {
+                    Self(__self_0_0) =>
+                        match ::core::cmp::Ord::cmp(&(__self_0_0), &(__self_1_0)) {
+                            ::core::cmp::Ordering::Equal =>
+                                ::core::cmp::Ordering::Equal,
+                            cmp => cmp,
+                        },
+                },
+        }
+    }
+}
+
 // A C-like, fieldless enum.
 enum Fieldless {