@@ -316,17 +316,23 @@ impl fmt::Debug for DefId {
316316
317317rustc_data_structures:: define_id_collections!( DefIdMap , DefIdSet , DefId ) ;
318318
319- /// A LocalDefId is equivalent to a DefId with `krate == LOCAL_CRATE`. Since
319+ /// A ` LocalDefId` is equivalent to a ` DefId` with `krate == LOCAL_CRATE`. Since
320320/// we encode this information in the type, we can ensure at compile time that
321- /// no DefIds from upstream crates get thrown into the mix. There are quite a
322- /// few cases where we know that only DefIds from the local crate are expected
323- /// and a DefId from a different crate would signify a bug somewhere. This
324- /// is when LocalDefId comes in handy.
321+ /// no `DefId`s from upstream crates get thrown into the mix. There are quite a
322+ /// few cases where we know that only `DefId`s from the local crate are expected;
323+ /// a ` DefId` from a different crate would signify a bug somewhere. This
324+ /// is when ` LocalDefId` comes in handy.
325325#[ derive( Clone , Copy , PartialEq , Eq , Hash ) ]
326326pub struct LocalDefId {
327327 pub local_def_index : DefIndex ,
328328}
329329
330+ // To ensure correctness of incremental compilation,
331+ // `LocalDefId` must not implement `Ord` or `PartialOrd`.
332+ // See https://github.com/rust-lang/rust/issues/90317.
333+ impl !Ord for LocalDefId { }
334+ impl !PartialOrd for LocalDefId { }
335+
330336pub const CRATE_DEF_ID : LocalDefId = LocalDefId { local_def_index : CRATE_DEF_INDEX } ;
331337
332338impl Idx for LocalDefId {
0 commit comments