Skip to content

Commit 00c8dc4

Browse files
committed
Auto merge of #103291 - ink-feather-org:typeid_no_struct_match, r=dtolnay
Remove structural match from `TypeId` As per rust-lang/rust#99189 (comment). > Removing the structural equality might make sense, but is a breaking change that'd require a libs-api FCP. rust-lang/rust#99189 (comment) > Landing this PR now (well, mainly the "remove structural equality" part) would unblock `const fn` `TypeId::of`, since we only postponed that because we were guaranteeing too much. See also #99189, #101698
2 parents 133f107 + e762b25 commit 00c8dc4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/src/any.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,20 @@ impl dyn Any + Send + Sync {
662662
/// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth
663663
/// noting that the hashes and ordering will vary between Rust releases. Beware
664664
/// of relying on them inside of your code!
665-
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
665+
#[derive(Clone, Copy, Debug, Hash, Eq, PartialOrd, Ord)]
666666
#[stable(feature = "rust1", since = "1.0.0")]
667667
pub struct TypeId {
668668
t: u64,
669669
}
670670

671+
#[stable(feature = "rust1", since = "1.0.0")]
672+
impl PartialEq for TypeId {
673+
#[inline]
674+
fn eq(&self, other: &Self) -> bool {
675+
self.t == other.t
676+
}
677+
}
678+
671679
impl TypeId {
672680
/// Returns the `TypeId` of the type this generic function has been
673681
/// instantiated with.

0 commit comments

Comments
 (0)