Auto merge of #126326 - eggyal:ununsafe-StableOrd, r=michaelwoerister
Un-unsafe the `StableOrd` trait Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc. [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Policy.20of.20.60unsafe.60.20within.20the.20compiler). cc [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), #105175, `@michaelwoerister` r? `@Nilstrieb`
This commit is contained in:
commit
c290e9de32
6 changed files with 76 additions and 28 deletions
|
@ -301,9 +301,12 @@ impl<HCX> ToStableHashKey<HCX> for WorkProductId {
|
|||
self.hash
|
||||
}
|
||||
}
|
||||
unsafe impl StableOrd for WorkProductId {
|
||||
impl StableOrd for WorkProductId {
|
||||
// Fingerprint can use unstable (just a tuple of `u64`s), so WorkProductId can as well
|
||||
const CAN_USE_UNSTABLE_SORT: bool = true;
|
||||
|
||||
// `WorkProductId` sort order is not affected by (de)serialization.
|
||||
const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = ();
|
||||
}
|
||||
|
||||
// Some types are used a lot. Make sure they don't unintentionally get bigger.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue