Skip to content

Commit d08fd37

Browse files
committed
the more recently added conflicts are more likely to still be relevant
This fixes most of the cases fount in #6258, in practice if not in theory.
1 parent a83cd61 commit d08fd37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cargo/core/resolver/conflict_cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ pub(super) struct ConflictCache {
3535
// unconditionally true regardless of our resolution history of how we got
3636
// here.
3737
con_from_dep: HashMap<Dependency, Vec<HashMap<PackageId, ConflictReason>>>,
38-
// `past_conflict_triggers` is an
39-
// of `past_conflicting_activations`.
40-
// For every `PackageId` this lists the `Dependency`s that mention it in `past_conflicting_activations`.
38+
// `dep_from_pid` is an inverse-index of `con_from_dep`.
39+
// For every `PackageId` this lists the `Dependency`s that mention it in `dep_from_pid`.
4140
dep_from_pid: HashMap<PackageId, HashSet<Dependency>>,
4241
}
4342

@@ -62,6 +61,7 @@ impl ConflictCache {
6261
self.con_from_dep
6362
.get(dep)?
6463
.iter()
64+
.rev() // more general cases are normally found letter. So start the search there.
6565
.filter(filter)
6666
.find(|conflicting| cx.is_conflicting(None, conflicting))
6767
}

0 commit comments

Comments
 (0)