Skip to content

Commit 50af117

Browse files
committed
we only need to search the part of the Trie that may contain the filler
1 parent b5453f3 commit 50af117

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/cargo/core/resolver/conflict_cache.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ impl ConflictStoreTrie {
2424
) -> Option<&BTreeMap<PackageId, ConflictReason>> {
2525
match self {
2626
ConflictStoreTrie::Leaf(c) => {
27-
if must_contain.map(|f| c.contains_key(&f)).unwrap_or(true) {
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-
None
34-
}
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)
3531
}
3632
ConflictStoreTrie::Node(m) => {
37-
for (&pid, store) in m {
33+
for (&pid, store) in must_contain
34+
.map(|f| m.range(..=f))
35+
.unwrap_or_else(|| m.range(..))
36+
{
3837
// if the key is active then we need to check all of the corresponding subTrie.
3938
if cx.is_active(pid) {
40-
if let Some(o) = store.find_conflicting(cx, must_contain) {
39+
if let Some(o) =
40+
store.find_conflicting(cx, must_contain.filter(|&f| f == pid))
41+
{
4142
return Some(o);
4243
}
4344
} // else, if it is not active then there is no way any of the corresponding

0 commit comments

Comments
 (0)