mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Fix bug in terms when collapsing unavailable versions in resolver errors (#9877)
Closes https://github.com/astral-sh/uv/issues/9861 Closes https://github.com/pubgrub-rs/pubgrub/issues/297
This commit is contained in:
parent
b2459e6326
commit
4bce1a32ec
5 changed files with 28 additions and 15 deletions
|
@ -673,13 +673,18 @@ fn collapse_unavailable_versions(
|
|||
// And the package and reason are the same...
|
||||
if package == other_package && reason == other_reason {
|
||||
// Collapse both into a new node, with a union of their ranges
|
||||
let versions = other_versions.union(versions);
|
||||
let mut terms = terms.clone();
|
||||
if let Some(Term::Positive(range)) = terms.get_mut(package) {
|
||||
*range = versions.clone();
|
||||
}
|
||||
*tree = DerivationTree::Derived(Derived {
|
||||
terms: terms.clone(),
|
||||
terms,
|
||||
shared_id: *shared_id,
|
||||
cause1: cause1.clone(),
|
||||
cause2: Arc::new(DerivationTree::External(External::Custom(
|
||||
package.clone(),
|
||||
versions.union(other_versions),
|
||||
versions,
|
||||
reason.clone(),
|
||||
))),
|
||||
});
|
||||
|
@ -696,12 +701,17 @@ fn collapse_unavailable_versions(
|
|||
// And the package and reason are the same...
|
||||
if package == other_package && reason == other_reason {
|
||||
// Collapse both into a new node, with a union of their ranges
|
||||
let versions = other_versions.union(versions);
|
||||
let mut terms = terms.clone();
|
||||
if let Some(Term::Positive(range)) = terms.get_mut(package) {
|
||||
*range = versions.clone();
|
||||
}
|
||||
*tree = DerivationTree::Derived(Derived {
|
||||
terms: terms.clone(),
|
||||
terms,
|
||||
shared_id: *shared_id,
|
||||
cause1: Arc::new(DerivationTree::External(External::Custom(
|
||||
package.clone(),
|
||||
versions.union(other_versions),
|
||||
versions,
|
||||
reason.clone(),
|
||||
))),
|
||||
cause2: cause2.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue