From f2bdaf1a4d38c06521bf9004c5b54ea97d29d6d4 Mon Sep 17 00:00:00 2001 From: raldone01 Date: Fri, 3 Feb 2023 21:26:14 +0100 Subject: [PATCH] Remove structural match from `TypeId`. --- library/core/src/any.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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.