Skip to content

Commit eeaebfc

Browse files
committed
oops...
1 parent 2814ca2 commit eeaebfc

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/cargo/core/resolver/conflict_cache.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ impl ConflictStoreTrie {
2424
) -> Option<&BTreeMap<PackageId, ConflictReason>> {
2525
match self {
2626
ConflictStoreTrie::Leaf(c) => {
27-
// is_conflicting checks that all the elements are active,
28-
// but we have checked each one by the recursion of this function.
29-
debug_assert!(cx.is_conflicting(None, c));
30-
Some(c)
27+
if must_contain.is_none() {
28+
// is_conflicting checks that all the elements are active,
29+
// but we have checked each one by the recursion of this function.
30+
debug_assert!(cx.is_conflicting(None, c));
31+
Some(c)
32+
} else {
33+
// we did not find `must_contain` so we need to keep looking.
34+
None
35+
}
3136
}
3237
ConflictStoreTrie::Node(m) => {
3338
for (&pid, store) in must_contain
@@ -37,7 +42,7 @@ impl ConflictStoreTrie {
3742
// if the key is active then we need to check all of the corresponding subTrie.
3843
if cx.is_active(pid) {
3944
if let Some(o) =
40-
store.find_conflicting(cx, must_contain.filter(|&f| f == pid))
45+
store.find_conflicting(cx, must_contain.filter(|&f| f != pid))
4146
{
4247
return Some(o);
4348
}
@@ -138,9 +143,18 @@ impl ConflictCache {
138143
dep: &Dependency,
139144
must_contain: Option<PackageId>,
140145
) -> Option<&BTreeMap<PackageId, ConflictReason>> {
141-
self.con_from_dep
146+
let out = self
147+
.con_from_dep
142148
.get(dep)?
143-
.find_conflicting(cx, must_contain)
149+
.find_conflicting(cx, must_contain);
150+
if cfg!(debug_assertions) {
151+
if let Some(f) = must_contain {
152+
if let Some(c) = &out {
153+
assert!(c.contains_key(&f));
154+
}
155+
}
156+
}
157+
out
144158
}
145159
pub fn conflicting(
146160
&self,

0 commit comments

Comments
 (0)