Skip to content

Commit fd9fc7c

Browse files
Make PartialEq impl for TypeId const
1 parent c5919c7 commit fd9fc7c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

library/core/src/any.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,20 @@ impl dyn Any + Send + Sync {
436436
/// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth
437437
/// noting that the hashes and ordering will vary between Rust releases. Beware
438438
/// of relying on them inside of your code!
439-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
439+
#[derive(Clone, Copy, Eq, PartialOrd, Ord, Debug, Hash)]
440440
#[stable(feature = "rust1", since = "1.0.0")]
441441
pub struct TypeId {
442442
t: u64,
443443
}
444444

445+
#[stable(feature = "rust1", since = "1.0.0")]
446+
#[rustc_const_unstable(feature = "const_type_id_cmp", issue = "none")]
447+
impl const PartialEq for TypeId {
448+
fn eq(&self, other: &Self) -> bool {
449+
self.t == other.t
450+
}
451+
}
452+
445453
impl TypeId {
446454
/// Returns the `TypeId` of the type this generic function has been
447455
/// instantiated with.

0 commit comments

Comments
 (0)