@@ -2,15 +2,15 @@ use std::collections::{BTreeMap, HashMap, HashSet};
22
33use log:: trace;
44
5- use super :: types:: ConflictReason ;
5+ use super :: types:: { Conflict , ConflictReason } ;
66use crate :: core:: resolver:: Context ;
77use crate :: core:: { Dependency , PackageId } ;
88
99/// This is a trie for storing a large number of sets designed to
1010/// efficiently see if any of the stored sets are a subset of a search set.
1111enum ConflictStoreTrie {
1212 /// One of the stored sets.
13- Leaf ( BTreeMap < PackageId , ConflictReason > ) ,
13+ Leaf ( Conflict ) ,
1414 /// A map from an element to a subtrie where
1515 /// all the sets in the subtrie contains that element.
1616 Node ( BTreeMap < PackageId , ConflictStoreTrie > ) ,
@@ -19,11 +19,7 @@ enum ConflictStoreTrie {
1919impl ConflictStoreTrie {
2020 /// Finds any known set of conflicts, if any,
2121 /// which are activated in `cx` and pass the `filter` specified?
22- fn find_conflicting (
23- & self ,
24- cx : & Context ,
25- must_contain : Option < PackageId > ,
26- ) -> Option < & BTreeMap < PackageId , ConflictReason > > {
22+ fn find_conflicting ( & self , cx : & Context , must_contain : Option < PackageId > ) -> Option < & Conflict > {
2723 match self {
2824 ConflictStoreTrie :: Leaf ( c) => {
2925 if must_contain. is_none ( ) {
@@ -57,11 +53,7 @@ impl ConflictStoreTrie {
5753 }
5854 }
5955
60- fn insert (
61- & mut self ,
62- mut iter : impl Iterator < Item = PackageId > ,
63- con : BTreeMap < PackageId , ConflictReason > ,
64- ) {
56+ fn insert ( & mut self , mut iter : impl Iterator < Item = PackageId > , con : Conflict ) {
6557 if let Some ( pid) = iter. next ( ) {
6658 if let ConflictStoreTrie :: Node ( p) = self {
6759 p. entry ( pid)
@@ -147,7 +139,7 @@ impl ConflictCache {
147139 cx : & Context ,
148140 dep : & Dependency ,
149141 must_contain : Option < PackageId > ,
150- ) -> Option < & BTreeMap < PackageId , ConflictReason > > {
142+ ) -> Option < & Conflict > {
151143 let out = self
152144 . con_from_dep
153145 . get ( dep) ?
@@ -161,18 +153,14 @@ impl ConflictCache {
161153 }
162154 out
163155 }
164- pub fn conflicting (
165- & self ,
166- cx : & Context ,
167- dep : & Dependency ,
168- ) -> Option < & BTreeMap < PackageId , ConflictReason > > {
156+ pub fn conflicting ( & self , cx : & Context , dep : & Dependency ) -> Option < & Conflict > {
169157 self . find_conflicting ( cx, dep, None )
170158 }
171159
172160 /// Adds to the cache a conflict of the form:
173161 /// `dep` is known to be unresolvable if
174162 /// all the `PackageId` entries are activated.
175- pub fn insert ( & mut self , dep : & Dependency , con : & BTreeMap < PackageId , ConflictReason > ) {
163+ pub fn insert ( & mut self , dep : & Dependency , con : & Conflict ) {
176164 if con. values ( ) . any ( |c| * c == ConflictReason :: PublicDependency ) {
177165 // TODO: needs more info for back jumping
178166 // for now refuse to cache it.
0 commit comments