diff --git a/src/internal/core.rs b/src/internal/core.rs index ac6d7757..c098d8b1 100644 --- a/src/internal/core.rs +++ b/src/internal/core.rs @@ -66,6 +66,26 @@ impl State { } } + /// Add the dependencies for the current version of the current package as incompatibilities. + pub fn add_package_version_dependencies( + &mut self, + package: DP::P, + version: DP::V, + dependencies: impl IntoIterator, + ) { + let dep_incompats = self.add_incompatibility_from_dependencies( + package.clone(), + 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 e4f3b742..ef2cb17e 100644 --- a/src/internal/partial_solution.rs +++ b/src/internal/partial_solution.rs @@ -365,7 +365,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: DP::P, version: DP::V, diff --git a/src/solver.rs b/src/solver.rs index 2abc2e37..87bdad3c 100644 --- a/src/solver.rs +++ b/src/solver.rs @@ -157,15 +157,7 @@ pub fn resolve( }; // Add that package and version if the dependencies are not problematic. - let dep_incompats = - state.add_incompatibility_from_dependencies(p.clone(), v.clone(), dependencies); - - state.partial_solution.add_version( - p.clone(), - v.clone(), - 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.