Skip to content

Commit 0f1791b

Browse files
committed
proptest, do we have more then one conflict that matches?
Yes, apparently we do. So I can't do optimizations based on that being unique.
1 parent 6bd554f commit 0f1791b

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/cargo/core/resolver/conflict_cache.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ impl ConflictStoreTrie {
3737
}
3838
}
3939
ConflictStoreTrie::Node(m) => {
40+
let mut out = None;
4041
for (&pid, store) in must_contain
4142
.map(|f| m.range(..=f))
4243
.unwrap_or_else(|| m.range(..))
@@ -46,13 +47,13 @@ impl ConflictStoreTrie {
4647
if let Some(o) =
4748
store.find_conflicting(cx, must_contain.filter(|&f| f != pid))
4849
{
49-
return Some(o);
50+
assert!(out.replace(o).is_none());
5051
}
5152
}
5253
// Else, if it is not active then there is no way any of the corresponding
5354
// subtrie will be conflicting.
5455
}
55-
None
56+
out
5657
}
5758
}
5859
}

tests/testsuite/resolve.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,3 +1407,31 @@ fn conflict_store_bug() {
14071407
let reg = registry(input);
14081408
let _ = resolve_and_validated(pkg_id("root"), vec![dep("j")], &reg);
14091409
}
1410+
1411+
#[test]
1412+
fn conflict_store_more_then_one_match() {
1413+
let input = vec![
1414+
pkg!(("A", "0.0.0")),
1415+
pkg!(("A", "0.0.1")),
1416+
pkg!(("A-sys", "0.0.0")),
1417+
pkg!(("A-sys", "0.0.1")),
1418+
pkg!(("A-sys", "0.0.2")),
1419+
pkg!(("A-sys", "0.0.3")),
1420+
pkg!(("A-sys", "0.0.12")),
1421+
pkg!(("A-sys", "0.0.16")),
1422+
pkg!(("B-sys", "0.0.0")),
1423+
pkg!(("B-sys", "0.0.1")),
1424+
pkg!(("B-sys", "0.0.2") => [dep_req("A-sys", "= 0.0.12"),]),
1425+
pkg!(("BA-sys", "0.0.0") => [dep_req("A-sys","= 0.0.16"),]),
1426+
pkg!(("BA-sys", "0.0.1") => [dep("bad"),]),
1427+
pkg!(("BA-sys", "0.0.2") => [dep("bad"),]),
1428+
pkg!("nA" => [
1429+
dep("A"),
1430+
dep_req("A-sys", "<= 0.0.3"),
1431+
dep("B-sys"),
1432+
dep("BA-sys"),
1433+
]),
1434+
];
1435+
let reg = registry(input);
1436+
let _ = resolve_and_validated(pkg_id("root"), vec![dep("nA")], &reg);
1437+
}

0 commit comments

Comments
 (0)