Skip to content

Remove PartialOrd/Ord impls for DefId and CrateNum #83006

Closed
@Aaron1011

Description

@Aaron1011

Both DefId and CrateNum are not stable across compilation sessions - the associated DefPathHash is a stable cross-session ID. However, both DefId and CrateNum have Ord impls, which makes it easy to accidentally sort something by the unstable DefID/CrateNum value. If this sorted result makes its way into a query result, it can lead to unstable hash values across compilation sessions. See #82920 for an example of this occuring.

My initial attempt to remove these impls encountered a large number of usages across multiple crates.

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions