about summary refs log tree commit diff
diff options
context:
space:
mode:
authorraldone01 <raldone01@gmail.com>2023-02-03 21:26:14 +0100
committerraldone01 <raldone01@gmail.com>2023-05-25 20:15:39 +0200
commitf2bdaf1a4d38c06521bf9004c5b54ea97d29d6d4 (patch)
treefee0dc1e3f3e89054a5a030b581518c3314fd264
parentcade26637fe1c23965ce644299ed5200db7c92dd (diff)
downloadrust-f2bdaf1a4d38c06521bf9004c5b54ea97d29d6d4.tar.gz
rust-f2bdaf1a4d38c06521bf9004c5b54ea97d29d6d4.zip
Remove structural match from `TypeId`.
-rw-r--r--library/core/src/any.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/library/core/src/any.rs b/library/core/src/any.rs
index d1c1ae6526b..7969f4055dd 100644
--- a/library/core/src/any.rs
+++ b/library/core/src/any.rs
@@ -662,12 +662,20 @@ impl dyn Any + Send + Sync {
 /// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth
 /// noting that the hashes and ordering will vary between Rust releases. Beware
 /// of relying on them inside of your code!
-#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
+#[derive(Clone, Copy, Debug, Hash, Eq, PartialOrd, Ord)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct TypeId {
     t: u64,
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl PartialEq for TypeId {
+    #[inline]
+    fn eq(&self, other: &Self) -> bool {
+        self.t == other.t
+    }
+}
+
 impl TypeId {
     /// Returns the `TypeId` of the type this generic function has been
     /// instantiated with.