@@ -28,9 +28,10 @@ use crate::{
2828/// during conflict resolution. More about all this in
2929/// [PubGrub documentation](https://github.com/dart-lang/pub/blob/master/doc/solver.md#incompatibility).
3030#[ derive( Debug , Clone ) ]
31- pub ( crate ) struct Incompatibility < P : Package , VS : VersionSet , M : Eq + Clone + Debug + Display > {
31+ pub struct Incompatibility < P : Package , VS : VersionSet , M : Eq + Clone + Debug + Display > {
3232 package_terms : SmallMap < Id < P > , Term < VS > > ,
33- kind : Kind < P , VS , M > ,
33+ /// The reason for the incompatibility.
34+ pub kind : Kind < P , VS , M > ,
3435}
3536
3637/// Type alias of unique identifiers for incompatibilities.
@@ -42,8 +43,9 @@ pub(crate) type IncompDpId<DP> = IncompId<
4243 <DP as DependencyProvider >:: M ,
4344> ;
4445
46+ /// The reason for the incompatibility.
4547#[ derive( Debug , Clone ) ]
46- enum Kind < P : Package , VS : VersionSet , M : Eq + Clone + Debug + Display > {
48+ pub enum Kind < P : Package , VS : VersionSet , M : Eq + Clone + Debug + Display > {
4749 /// Initial incompatibility aiming at picking the root package for the first decision.
4850 ///
4951 /// This incompatibility drives the resolution, it requires that we pick the (virtual) root
@@ -104,7 +106,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibilit
104106 }
105107
106108 /// Create an incompatibility to remember that a given set does not contain any version.
107- pub ( crate ) fn no_versions ( package : Id < P > , term : Term < VS > ) -> Self {
109+ pub fn no_versions ( package : Id < P > , term : Term < VS > ) -> Self {
108110 let set = match & term {
109111 Term :: Positive ( r) => r. clone ( ) ,
110112 Term :: Negative ( _) => panic ! ( "No version should have a positive term" ) ,
@@ -117,7 +119,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibilit
117119
118120 /// Create an incompatibility for a reason outside pubgrub.
119121 #[ allow( dead_code) ] // Used by uv
120- pub ( crate ) fn custom_term ( package : Id < P > , term : Term < VS > , metadata : M ) -> Self {
122+ pub fn custom_term ( package : Id < P > , term : Term < VS > , metadata : M ) -> Self {
121123 let set = match & term {
122124 Term :: Positive ( r) => r. clone ( ) ,
123125 Term :: Negative ( _) => panic ! ( "No version should have a positive term" ) ,
@@ -129,7 +131,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibilit
129131 }
130132
131133 /// Create an incompatibility for a reason outside pubgrub.
132- pub ( crate ) fn custom_version ( package : Id < P > , version : VS :: V , metadata : M ) -> Self {
134+ pub fn custom_version ( package : Id < P > , version : VS :: V , metadata : M ) -> Self {
133135 let set = VS :: singleton ( version) ;
134136 let term = Term :: Positive ( set. clone ( ) ) ;
135137 Self {
@@ -139,7 +141,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibilit
139141 }
140142
141143 /// Build an incompatibility from a given dependency.
142- pub ( crate ) fn from_dependency ( package : Id < P > , versions : VS , dep : ( Id < P > , VS ) ) -> Self {
144+ pub fn from_dependency ( package : Id < P > , versions : VS , dep : ( Id < P > , VS ) ) -> Self {
143145 let ( p2, set2) = dep;
144146 Self {
145147 package_terms : if set2 == VS :: empty ( ) {
@@ -345,6 +347,7 @@ impl<'a, P: Package, VS: VersionSet + 'a, M: Eq + Clone + Debug + Display + 'a>
345347}
346348
347349impl < P : Package , VS : VersionSet , M : Eq + Clone + Debug + Display > Incompatibility < P , VS , M > {
350+ /// Display the incompatibility.
348351 pub fn display < ' a > ( & ' a self , package_store : & ' a HashArena < P > ) -> impl Display + ' a {
349352 match self . iter ( ) . collect :: < Vec < _ > > ( ) . as_slice ( ) {
350353 [ ] => "version solving failed" . into ( ) ,
0 commit comments