From c28b80c321d34e143074e5bac03b24b8545f2cb7 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 14 Mar 2025 13:54:17 +0100 Subject: [PATCH] internal: `Symbol` is not `PartialOrd` --- crates/hir-expand/src/proc_macro.rs | 6 ++++-- crates/intern/src/symbol.rs | 14 +------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/crates/hir-expand/src/proc_macro.rs b/crates/hir-expand/src/proc_macro.rs index 9dcd5ef1ef..ceb6972a50 100644 --- a/crates/hir-expand/src/proc_macro.rs +++ b/crates/hir-expand/src/proc_macro.rs @@ -78,8 +78,10 @@ impl ProcMacrosBuilder { if let Ok(proc_macros) = &mut proc_macro { // Sort proc macros to improve incrementality when only their order has changed (ideally the build system // will not change their order, but just to be sure). - proc_macros - .sort_unstable_by_key(|proc_macro| (proc_macro.name.clone(), proc_macro.kind)); + proc_macros.sort_unstable_by(|proc_macro, proc_macro2| { + (proc_macro.name.as_str(), proc_macro.kind) + .cmp(&(proc_macro2.name.as_str(), proc_macro2.kind)) + }); } self.0.insert( proc_macros_crate, diff --git a/crates/intern/src/symbol.rs b/crates/intern/src/symbol.rs index f02fb6d14f..22490e416a 100644 --- a/crates/intern/src/symbol.rs +++ b/crates/intern/src/symbol.rs @@ -42,18 +42,6 @@ struct TaggedArcPtr { unsafe impl Send for TaggedArcPtr {} unsafe impl Sync for TaggedArcPtr {} -impl Ord for TaggedArcPtr { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.as_str().cmp(other.as_str()) - } -} - -impl PartialOrd for TaggedArcPtr { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl TaggedArcPtr { const BOOL_BITS: usize = true as usize; @@ -125,7 +113,7 @@ impl TaggedArcPtr { } } -#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)] +#[derive(PartialEq, Eq, Hash)] pub struct Symbol { repr: TaggedArcPtr, }