From cf3ab41c8331bac9aa8efc1a3d75b8bdeb8f26cc Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 21 Mar 2024 17:24:49 +0000 Subject: Ensure no one re-adds `Partial/Ord` impls for `DefId` --- compiler/rustc_span/src/def_id.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/rustc_span') 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: -- cgit 1.4.1-3-g733a5