about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src
diff options
context:
space:
mode:
authorAlan Egerton <eggyal@gmail.com>2024-06-22 07:11:42 +0100
committerAlan Egerton <eggyal@gmail.com>2024-06-22 07:17:02 +0100
commit0e73e7095ae7aa7ead69c4ba7ba002560ef118fa (patch)
tree53404cdeb87fe3cc5dee1ebc7688c5c1947017fa /compiler/rustc_query_system/src
parent114dd2061e0bfa6bc1353d0265389cfaa04d8858 (diff)
downloadrust-0e73e7095ae7aa7ead69c4ba7ba002560ef118fa.tar.gz
rust-0e73e7095ae7aa7ead69c4ba7ba002560ef118fa.zip
Ensure careful consideration is given by impls
Added an associated `const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED`
to the `StableOrd` trait to ensure that implementors carefully consider
whether the trait's contract is upheld, as incorrect implementations can
cause miscompilations.
Diffstat (limited to 'compiler/rustc_query_system/src')
-rw-r--r--compiler/rustc_query_system/src/dep_graph/dep_node.rs3
1 files changed, 3 insertions, 0 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 3fb59ad26f6..f2a68e35671 100644
--- a/compiler/rustc_query_system/src/dep_graph/dep_node.rs
+++ b/compiler/rustc_query_system/src/dep_graph/dep_node.rs
@@ -304,6 +304,9 @@ impl<HCX> ToStableHashKey<HCX> 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.