Skip to content

Commit 138a20b

Browse files
committed
fix(tree): Make output more deterministic
When you have a dependency show up in multiple dependency tables, the order they are processed was not deterministic. Its hard to predict the exact effects this was having (e.g. for writing tests for this) but changing this made #15366 not reproduce anymore for me. I'm going to consier this as fixing #15366 mostly because how difficult it is to debug with the non-determinism. If someone can find a case where this fails, at least it should now always fail and it should be easier to determine why. Fixes #15366
1 parent 585f66a commit 138a20b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cargo/ops/tree/graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ fn add_pkg(
478478
continue;
479479
}
480480

481-
deps.sort_unstable_by_key(|dep| dep.name_in_toml());
481+
deps.sort_unstable_by_key(|dep| (dep.kind(), dep.name_in_toml()));
482482
let dep_pkg = graph.package_map[&dep_id];
483483

484484
for dep in deps {

0 commit comments

Comments
 (0)