Closed
Description
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.