diff options
| author | bors <bors@rust-lang.org> | 2024-06-25 15:51:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-25 15:51:35 +0000 |
| commit | c290e9de32e8ba6a673ef125fde40eadd395d170 (patch) | |
| tree | 9d40c19ec778317c30ae2770bed4f993373ce60d /compiler/rustc_query_system | |
| parent | d929a42a664c026167800801b26d734db925314f (diff) | |
| parent | 0e73e7095ae7aa7ead69c4ba7ba002560ef118fa (diff) | |
| download | rust-c290e9de32e8ba6a673ef125fde40eadd395d170.tar.gz rust-c290e9de32e8ba6a673ef125fde40eadd395d170.zip | |
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`
Diffstat (limited to 'compiler/rustc_query_system')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/dep_node.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/dep_node.rs b/compiler/rustc_query_system/src/dep_graph/dep_node.rs index 5f1a03502a7..f2a68e35671 100644 --- a/compiler/rustc_query_system/src/dep_graph/dep_node.rs +++ b/compiler/rustc_query_system/src/dep_graph/dep_node.rs @@ -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. |
