uv-resolver: make PubGrubPackage orderable

It turns out that we use PubGrubPackage as the key in hashmaps in a fair
few places. And when we iterate over hashmaps, the order is unspecified.
This can in turn result in changes in output as a result of changes in
the PubGrubPackage definition, purely as a function of its changing
hash. This is confusing as there should be no semantic difference.

Thus, this is a precursor to introducing some more determinism to places
I found in the error reporting whose output depending on hashmap
iteration order.
This commit is contained in:
Andrew Gallant 2024-05-20 13:11:07 -04:00 committed by Andrew Gallant
parent 9f109f243c
commit 976bc9ba0e
5 changed files with 21 additions and 10 deletions

View file

@ -23,7 +23,7 @@ use crate::FetchStrategy;
const CHECKOUT_READY_LOCK: &str = ".ok";
/// A reference to commit or commit-ish.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum GitReference {
/// A specific branch.
Branch(String),

View file

@ -12,7 +12,7 @@ mod source;
mod util;
/// A URL reference to a Git repository.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Hash, Ord)]
pub struct GitUrl {
/// The URL of the Git repository, with any query parameters, fragments, and leading `git+`
/// removed.