Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo metadata output should be reproducible #8477

Closed
matklad opened this issue Jul 10, 2020 · 0 comments · Fixed by #8489
Closed

cargo metadata output should be reproducible #8477

matklad opened this issue Jul 10, 2020 · 0 comments · Fixed by #8489
Labels

Comments

@matklad
Copy link
Member

matklad commented Jul 10, 2020

Inside rust-analyzer repository:

λ cargo metadata > a.json
λ cargo metadata > b.json
λ diff --brief  a.json b.json
Files a.json and b.json differ
λ cargo --version
cargo 1.44.1 (88ba85757 2020-06-11)

I think it generally would be better if this was reproducible. In particular, in rust-analyzer we'd love to avoid reloading the workspace if "nothing changed", and non-reproducibility requires us to additionally sort things.

@matklad matklad added the C-bug Category: bug label Jul 10, 2020
matklad added a commit to matklad/rust-analyzer that referenced this issue Jul 10, 2020
See rust-lang/cargo#8477

We need this to prevent spurious workspace reloads
bors added a commit that referenced this issue Jul 16, 2020
Make `cargo metadata` output deterministic

Uses BTreeMap instead of HashMap for the `cargo metadata` command, ensuring the output is sorted.

The change did not cause a measurable performance impact for running `cargo metadata` on `cargo` itself.

Fixes #8477
@bors bors closed this as completed in 18ff915 Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants