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
|
@ -120,9 +120,11 @@ impl Default for DefPathHash {
|
|||
}
|
||||
}
|
||||
|
||||
// Safety: `DefPathHash` sort order is not affected (de)serialization.
|
||||
unsafe impl StableOrd for DefPathHash {
|
||||
impl StableOrd for DefPathHash {
|
||||
const CAN_USE_UNSTABLE_SORT: bool = true;
|
||||
|
||||
// `DefPathHash` sort order is not affected by (de)serialization.
|
||||
const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = ();
|
||||
}
|
||||
|
||||
/// A [`StableCrateId`] is a 64-bit hash of a crate name, together with all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue