Skip to content

Commit

Permalink
Auto merge of #103291 - ink-feather-org:typeid_no_struct_match, r=dto…
Browse files Browse the repository at this point in the history
…lnay

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
  • Loading branch information
bors committed May 26, 2023
2 parents 133f107 + e762b25 commit 00c8dc4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 00c8dc4

Please sign in to comment.