about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-21 17:24:49 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-27 14:02:17 +0000
commitcf3ab41c8331bac9aa8efc1a3d75b8bdeb8f26cc (patch)
tree009609d6c86df67ab029d5e8816b03faeb512222
parent5f4ac61ebdeb5024744e0a828d2ff79b2b71740d (diff)
downloadrust-cf3ab41c8331bac9aa8efc1a3d75b8bdeb8f26cc.tar.gz
rust-cf3ab41c8331bac9aa8efc1a3d75b8bdeb8f26cc.zip
Ensure no one re-adds `Partial/Ord` impls for `DefId`
-rw-r--r--compiler/rustc_span/src/def_id.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index 5454f6661a9..8f721bac951 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -234,6 +234,12 @@ pub struct DefId {
     pub index: DefIndex,
 }
 
+// To ensure correctness of incremental compilation,
+// `DefId` must not implement `Ord` or `PartialOrd`.
+// See https://github.com/rust-lang/rust/issues/90317.
+impl !Ord for DefId {}
+impl !PartialOrd for DefId {}
+
 // On 64-bit systems, we can hash the whole `DefId` as one `u64` instead of two `u32`s. This
 // improves performance without impairing `FxHash` quality. So the below code gets compiled to a
 // noop on little endian systems because the memory layout of `DefId` is as follows: