@@ -316,17 +316,23 @@ impl fmt::Debug for DefId {
316
316
317
317
rustc_data_structures:: define_id_collections!( DefIdMap , DefIdSet , DefId ) ;
318
318
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
320
320
/// 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.
325
325
#[ derive( Clone , Copy , PartialEq , Eq , Hash ) ]
326
326
pub struct LocalDefId {
327
327
pub local_def_index : DefIndex ,
328
328
}
329
329
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
+
330
336
pub const CRATE_DEF_ID : LocalDefId = LocalDefId { local_def_index : CRATE_DEF_INDEX } ;
331
337
332
338
impl Idx for LocalDefId {
0 commit comments