diff --git a/src/internal/core.rs b/src/internal/core.rs index 79f6fa9c..a476ec16 100644 --- a/src/internal/core.rs +++ b/src/internal/core.rs @@ -73,6 +73,23 @@ impl State { } } + /// Add the dependencies for the current version of the current package as incompatibilities. + pub fn add_package_version_dependencies( + &mut self, + package: Id, + version: DP::V, + dependencies: impl IntoIterator, + ) { + let dep_incompats = + self.add_incompatibility_from_dependencies(package, version.clone(), dependencies); + self.partial_solution.add_package_version_incompatibilities( + package.clone(), + version.clone(), + dep_incompats, + &self.incompatibility_store, + ) + } + /// Add an incompatibility to the state. pub fn add_incompatibility(&mut self, incompat: Incompatibility) { let id = self.incompatibility_store.alloc(incompat); diff --git a/src/internal/partial_solution.rs b/src/internal/partial_solution.rs index f1b3dde5..2c36e256 100644 --- a/src/internal/partial_solution.rs +++ b/src/internal/partial_solution.rs @@ -375,7 +375,7 @@ impl PartialSolution { /// In practice I think it can only produce a conflict if one of the dependencies /// (which are used to make the new incompatibilities) /// is already in the partial solution with an incompatible version. - pub(crate) fn add_version( + pub(crate) fn add_package_version_incompatibilities( &mut self, package: Id, version: DP::V, diff --git a/src/solver.rs b/src/solver.rs index a8aff4bf..29d475d2 100644 --- a/src/solver.rs +++ b/src/solver.rs @@ -171,12 +171,7 @@ pub fn resolve( }; // Add that package and version if the dependencies are not problematic. - let dep_incompats = - state.add_incompatibility_from_dependencies(p, v.clone(), dependencies); - - state - .partial_solution - .add_version(p, v, dep_incompats, &state.incompatibility_store); + state.add_package_version_dependencies(p.clone(), v.clone(), dependencies); } else { // `dep_incompats` are already in `incompatibilities` so we know there are not satisfied // terms and can add the decision directly.