From 2c297fa26608d4f79c3caa6aae1a830170a9f9c7 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 13 Nov 2024 09:49:57 +0100 Subject: [PATCH] make issue ordering stable --- turbopack/crates/turbopack-core/src/issue/mod.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/turbopack/crates/turbopack-core/src/issue/mod.rs b/turbopack/crates/turbopack-core/src/issue/mod.rs index abab6c516b343..45db9fb485da1 100644 --- a/turbopack/crates/turbopack-core/src/issue/mod.rs +++ b/turbopack/crates/turbopack-core/src/issue/mod.rs @@ -720,6 +720,7 @@ impl Ord for PlainIssue { cmp!(self.description, other.description); cmp!(self.detail, other.detail); cmp!(self.documentation_link, other.documentation_link); + cmp!(self.source, other.source); Ordering::Equal } } @@ -791,7 +792,7 @@ impl PlainIssue { } #[turbo_tasks::value(serialization = "none")] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialOrd, Ord)] pub struct PlainIssueSource { pub asset: ReadRef, pub range: Option<(SourcePos, SourcePos)>, @@ -851,6 +852,18 @@ impl PlainSource { } } +impl Ord for PlainSource { + fn cmp(&self, other: &Self) -> Ordering { + self.ident.cmp(&other.ident) + } +} + +impl PartialOrd for PlainSource { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + #[turbo_tasks::value(transparent, serialization = "none")] #[derive(Clone, Debug, DeterministicHash)] pub struct PlainIssueProcessingPath(Option>>);