@@ -876,7 +876,7 @@ impl ::core::cmp::PartialEq for Enum1 {
876876 fn eq(&self, other: &Enum1) -> bool {
877877 match (self, other) {
878878 (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
879- * __self_0 == * __arg1_0,
879+ __self_0 == __arg1_0,
880880 }
881881 }
882882}
@@ -1119,10 +1119,10 @@ impl ::core::cmp::PartialEq for Mixed {
11191119 __self_discr == __arg1_discr &&
11201120 match (self, other) {
11211121 (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
1122- * __self_0 == * __arg1_0,
1122+ __self_0 == __arg1_0,
11231123 (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
11241124 d1: __arg1_0, d2: __arg1_1 }) =>
1125- * __self_0 == * __arg1_0 && * __self_1 == * __arg1_1,
1125+ __self_0 == __arg1_0 && __self_1 == __arg1_1,
11261126 _ => true,
11271127 }
11281128 }
@@ -1245,11 +1245,11 @@ impl ::core::cmp::PartialEq for Fielded {
12451245 __self_discr == __arg1_discr &&
12461246 match (self, other) {
12471247 (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
1248- * __self_0 == * __arg1_0,
1248+ __self_0 == __arg1_0,
12491249 (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
1250- * __self_0 == * __arg1_0,
1250+ __self_0 == __arg1_0,
12511251 (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
1252- * __self_0 == * __arg1_0,
1252+ __self_0 == __arg1_0,
12531253 _ => unsafe { ::core::intrinsics::unreachable() }
12541254 }
12551255 }
@@ -1368,9 +1368,9 @@ impl<T: ::core::cmp::PartialEq, U: ::core::cmp::PartialEq>
13681368 __self_discr == __arg1_discr &&
13691369 match (self, other) {
13701370 (EnumGeneric::One(__self_0), EnumGeneric::One(__arg1_0)) =>
1371- * __self_0 == * __arg1_0,
1371+ __self_0 == __arg1_0,
13721372 (EnumGeneric::Two(__self_0), EnumGeneric::Two(__arg1_0)) =>
1373- * __self_0 == * __arg1_0,
1373+ __self_0 == __arg1_0,
13741374 _ => unsafe { ::core::intrinsics::unreachable() }
13751375 }
13761376 }
@@ -1426,6 +1426,30 @@ impl<T: ::core::cmp::Ord, U: ::core::cmp::Ord> ::core::cmp::Ord for
14261426 }
14271427}
14281428
1429+ // An enum that has variant, which does't implement `Copy`.
1430+ enum NonCopyEnum {
1431+
1432+ // The `dyn NonCopyTrait` implements `PartialEq`, but it doesn't require `Copy`.
1433+ // So we cannot generate `PartialEq` with dereference.
1434+ NonCopyField(Box<dyn NonCopyTrait>),
1435+ }
1436+ #[automatically_derived]
1437+ impl ::core::marker::StructuralPartialEq for NonCopyEnum { }
1438+ #[automatically_derived]
1439+ impl ::core::cmp::PartialEq for NonCopyEnum {
1440+ #[inline]
1441+ fn eq(&self, other: &NonCopyEnum) -> bool {
1442+ match (self, other) {
1443+ (NonCopyEnum::NonCopyField(__self_0),
1444+ NonCopyEnum::NonCopyField(__arg1_0)) => __self_0 == __arg1_0,
1445+ }
1446+ }
1447+ }
1448+ trait NonCopyTrait {}
1449+ impl PartialEq for dyn NonCopyTrait {
1450+ fn eq(&self, _other: &Self) -> bool { true }
1451+ }
1452+
14291453// A union. Most builtin traits are not derivable for unions.
14301454pub union Union {
14311455 pub b: bool,
0 commit comments