let x = &&Baz;
let y = &Baz;
y.to_owned() == **x;
+
+ let x = 0u32;
+ let y = U32Wrapper(x);
+ let _ = U32Wrapper::from(x) == y;
}
struct Foo;
}
}
-#[derive(PartialEq)]
+#[derive(PartialEq, Eq)]
struct Baz;
impl ToOwned for Baz {
}
}
-#[derive(PartialEq)]
+#[derive(PartialEq, Eq)]
struct Bar;
impl PartialEq<Foo> for Bar {
&FOO
}
}
+
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+struct U32Wrapper(u32);
+impl From<u32> for U32Wrapper {
+ fn from(x: u32) -> Self {
+ Self(x)
+ }
+}
+impl PartialEq<u32> for U32Wrapper {
+ fn eq(&self, other: &u32) -> bool {
+ self.0 == *other
+ }
+}
+impl PartialEq<U32Wrapper> for u32 {
+ fn eq(&self, other: &U32Wrapper) -> bool {
+ *self == other.0
+ }
+}