Skip to content

Commit cf3ab41

Browse files
committed
Ensure no one re-adds Partial/Ord impls for DefId
1 parent 5f4ac61 commit cf3ab41

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_span/src/def_id.rs

+6
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ pub struct DefId {
234234
pub index: DefIndex,
235235
}
236236

237+
// To ensure correctness of incremental compilation,
238+
// `DefId` must not implement `Ord` or `PartialOrd`.
239+
// See https://github.com/rust-lang/rust/issues/90317.
240+
impl !Ord for DefId {}
241+
impl !PartialOrd for DefId {}
242+
237243
// On 64-bit systems, we can hash the whole `DefId` as one `u64` instead of two `u32`s. This
238244
// improves performance without impairing `FxHash` quality. So the below code gets compiled to a
239245
// noop on little endian systems because the memory layout of `DefId` is as follows:

0 commit comments

Comments
 (0)