fix(toml): Ensure targets are in a deterministic order#13989
Merged
bors merged 1 commit intorust-lang:masterfrom May 31, 2024
Merged
fix(toml): Ensure targets are in a deterministic order#13989bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
With rust-lang#13713, we enumerate all targets in `Cargo.toml` on `cargo publish` and `cargo vendor`. However, the order of the targets is non-determistic. This can be annoying for comparing the published `Cargo.toml` across releases but even worse is the churn it causes for `cargo vendor`. So we sort all the targets during publish. This keeps costs minimal with the following risks - If the non-determinism shows up in a way that affects developers during development - If there is a reason the user wants to control target order for explicit targets Fixes rust-lang#13988
Collaborator
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
weihanglo
approved these changes
May 31, 2024
Member
weihanglo
left a comment
There was a problem hiding this comment.
This makes sense. I just checked the other sections. They should all be controlled by BTreeMap so should be fine.
Thanks for the fix!
Member
|
@bors r+ |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-actions |
1 similar comment
Contributor
|
☀️ Test successful - checks-actions |
Contributor
|
👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 1, 2024
Update cargo 9 commits in 431db31d0dbeda320caf8ef8535ea48eb3093407..7a6fad0984d28c8330974636972aa296b67c4513 2024-05-28 18:17:31 +0000 to 2024-05-31 22:26:03 +0000 - fix(config): Ensure `--config net.git-fetch-with-cli=true` is respected (rust-lang/cargo#13992) - Fix libcurl proxy documentation link (rust-lang/cargo#13990) - fix(new): Dont say were adding to a workspace when a regular package is in root (rust-lang/cargo#13987) - fix: adjust custom err from cert-check due to libgit2 1.8 change (rust-lang/cargo#13970) - fix(toml): Ensure targets are in a deterministic order (rust-lang/cargo#13989) - doc(cargo-package): explain no guarantee of vcs provenance (rust-lang/cargo#13984) - chore: fix some comments (rust-lang/cargo#13982) - feat: stabilize `cargo update --precise <yanked>` (rust-lang/cargo#13974) - Update openssl-src to 111.28.2+1.1.1w (rust-lang/cargo#13976) r? ghost
bors
added a commit
that referenced
this pull request
Jun 3, 2024
fix(vendor): Ensure sort happens for vendor ### What does this PR try to resolve? This is a follow up to #13989 which sorted in time for `cargo package` and `cargo publish` but too late for `cargo vendor`. This moves the sorting earlier and puts it in a place that will only run when resolving. Fixes #13988 ### How should we test and review this PR? I had assumed tests existed but just happened to write in a way that leads to sorting. Apparently not. I've added some tests. The `cargo vendor` test has to elide paths because `/`s are normalized during publish, rather than resolve, so the output varies across platforms, even with cargo-test-support normalizing slashes because `toml` will switch between `"` and `'`. ### Additional information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
With #13713, we enumerate all targets in
Cargo.tomloncargo publishandcargo vendor.However, the order of the targets is non-determistic. This can be annoying for comparing the published
Cargo.tomlacross releases but even worse is the churn it causes forcargo vendor.So we sort all the targets during publish.
This keeps costs minimal with the following risks
Fixes #13988
How should we test and review this PR?
As for writing of tests, I'm unsure why none of our existing tests failed which makes it unclear to me what would be needed to write a test for this.
Additional information