Remove DefId
's Partial/Ord
impls
This commit is contained in:
parent
e522d2906d
commit
5f4ac61ebd
5 changed files with 10 additions and 29 deletions
|
@ -218,8 +218,6 @@ rustc_index::newtype_index! {
|
|||
///
|
||||
/// You can create a `DefId` from a `LocalDefId` using `local_def_id.to_def_id()`.
|
||||
#[derive(Clone, PartialEq, Eq, Copy)]
|
||||
// Don't derive order on 64-bit big-endian, so we can be consistent regardless of field order.
|
||||
#[cfg_attr(not(all(target_pointer_width = "64", target_endian = "big")), derive(PartialOrd, Ord))]
|
||||
// On below-64 bit systems we can simply use the derived `Hash` impl
|
||||
#[cfg_attr(not(target_pointer_width = "64"), derive(Hash))]
|
||||
#[repr(C)]
|
||||
|
@ -261,22 +259,6 @@ impl Hash for DefId {
|
|||
}
|
||||
}
|
||||
|
||||
// Implement the same comparison as derived with the other field order.
|
||||
#[cfg(all(target_pointer_width = "64", target_endian = "big"))]
|
||||
impl Ord for DefId {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &DefId) -> std::cmp::Ordering {
|
||||
Ord::cmp(&(self.index, self.krate), &(other.index, other.krate))
|
||||
}
|
||||
}
|
||||
#[cfg(all(target_pointer_width = "64", target_endian = "big"))]
|
||||
impl PartialOrd for DefId {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &DefId) -> Option<std::cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl DefId {
|
||||
/// Makes a local `DefId` from the given `DefIndex`.
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue