@@ -41,7 +41,7 @@ pub type IncompId<P, V> = Id<Incompatibility<P, V>>;
41
41
#[ derive( Debug , Clone ) ]
42
42
enum Kind < P : Package , V : Version > {
43
43
/// Initial incompatibility aiming at picking the root package for the first decision.
44
- NotRoot ( P , V ) ,
44
+ NotRoot ,
45
45
/// There are no versions in the given range for this package.
46
46
NoVersions ,
47
47
/// Dependencies of the package are unavailable for versions in that range.
@@ -76,11 +76,8 @@ impl<P: Package, V: Version> Incompatibility<P, V> {
76
76
/// Create the initial "not Root" incompatibility.
77
77
pub fn not_root ( package : P , version : V ) -> Self {
78
78
Self {
79
- package_terms : SmallMap :: One ( [ (
80
- package. clone ( ) ,
81
- Term :: Negative ( Range :: exact ( version. clone ( ) ) ) ,
82
- ) ] ) ,
83
- kind : Kind :: NotRoot ( package, version) ,
79
+ package_terms : SmallMap :: One ( [ ( package, Term :: Negative ( Range :: exact ( version) ) ) ] ) ,
80
+ kind : Kind :: NotRoot ,
84
81
}
85
82
}
86
83
@@ -238,11 +235,25 @@ impl<P: Package, V: Version> Incompatibility<P, V> {
238
235
self_id : Id < Self > ,
239
236
shared_ids : & Set < Id < Self > > ,
240
237
store : & Arena < Self > ,
238
+ root_package : & P ,
239
+ root_version : & V ,
241
240
) -> DerivationTree < P , V > {
242
241
match & store[ self_id] . kind {
243
242
Kind :: DerivedFrom ( id1, id2) => {
244
- let cause1 = Self :: build_derivation_tree ( * id1, shared_ids, store) ;
245
- let cause2 = Self :: build_derivation_tree ( * id2, shared_ids, store) ;
243
+ let cause1 = Self :: build_derivation_tree (
244
+ * id1,
245
+ shared_ids,
246
+ store,
247
+ root_package,
248
+ root_version,
249
+ ) ;
250
+ let cause2 = Self :: build_derivation_tree (
251
+ * id2,
252
+ shared_ids,
253
+ store,
254
+ root_package,
255
+ root_version,
256
+ ) ;
246
257
let derived = Derived {
247
258
terms : store[ self_id] . package_terms . as_map ( ) ,
248
259
shared_id : shared_ids. get ( & self_id) . map ( |id| id. into_raw ( ) ) ,
@@ -251,9 +262,10 @@ impl<P: Package, V: Version> Incompatibility<P, V> {
251
262
} ;
252
263
DerivationTree :: Derived ( derived)
253
264
}
254
- Kind :: NotRoot ( package, version) => {
255
- DerivationTree :: External ( External :: NotRoot ( package. clone ( ) , version. clone ( ) ) )
256
- }
265
+ Kind :: NotRoot => DerivationTree :: External ( External :: NotRoot (
266
+ root_package. clone ( ) ,
267
+ root_version. clone ( ) ,
268
+ ) ) ,
257
269
Kind :: NoVersions => match & store[ self_id] . package_terms {
258
270
SmallMap :: One ( [ ( package, Term :: Positive ( range) ) ] ) => {
259
271
DerivationTree :: External ( External :: NoVersions ( package. clone ( ) , range. clone ( ) ) )
0 commit comments