refactor: Transition direct assertions from cargo-test-support to snapbox
### What does this PR try to resolve?
Cargo has a bespoke testing framework for functional tests
- Extra stuff for us to maintain
- Don't leverage benefits from contributions related to other projects
- Less incentive to be thoroughly documented
UI tests are written using snapbox. The latest release of snapbox (#13963) was geared at supporting cargo's needs in the hope that we can consolidate on testing frameworks.
Besides having a single set of semantics, benefits we'd gain include
- Updating of test snapshots
- Fancier redacting of test output (e.g. #13973)
This is the first incremental step in this direction. This replaces direct assertions with snapbox assertions. This still leaves all of the CLI output assertions. These will be done incrementally.
### How should we test and review this PR?
### Additional information
Fix: Skip deserialization of unrelated fields with overlapping name
### What does this PR try to resolve?
Split from https://github.com/rust-lang/cargo/pull/13687#discussion_r1622694446
This fixes the overlap of environment variable names:
> For example, when env_key is UNSTABLE_GITOXIDE_FETCH
and field_key is UNSTABLE_GIT, the field shouldn't be
added because `unstable.gitoxide.fetch` doesn't
belong to `unstable.git` struct.
### How should we test and review this PR?
Updates of test cases `struct_with_overlapping_inner_struct_and_defaults` can be used to compare changes before and after changes
### Additional information
r? weihanglo and very appreciate your more optimized code
chore(deps): update alpine docker tag to v3.20
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| alpine | final | minor | `3.19` -> `3.20` |
---
### Configuration
📅 **Schedule**: Branch creation - "before 5am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM3Ny44IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
fix(config): Ensure `--config net.git-fetch-with-cli=true` is respected
### What does this PR try to resolve?
#13479 changed the global context initialization order so that command line stuff is processed after we read some config.
This had a side effect of breaking `--config net.git-fetch-with-cli=true`.
I reverted the change to restore support for `--config`.
Fixes#13991
### How should we test and review this PR?
### Additional information
This reverts commit f525e1f383.
This removes color control from warnings for unstable features.
For some reason this removed color support from `cargo -Zhelp` in the
tests but I can't reproduce it locally.
The most important thing was getting the config fix in.
There are two follow ups
- Can we have the config working *and* color?
- Why did this fail for this field and not the others we already had
tests for?
I ran out my immediate time box for looking into these.
This reverts commit f525e1f383.
This removes color control from warnings for unstable features.
For some reason this removed color support from `cargo -Zhelp` in the
tests but I can't reproduce it locally.
The most important thing was getting the config fix in.
There are two follow ups
- Can we have the config working *and* color?
- Why did this fail for this field and not the others we already had
tests for?
I ran out my immediate time box for looking into these.
Fixes#13991
Fix libcurl proxy documentation link
### What does this PR try to resolve?
Fixes a broken link to the libcurl proxy documentation by updating it with new location.
fix(toml): Ensure targets are in a deterministic order
### What does this PR try to resolve?
With #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#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
With #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#13988
This comes with improved redacting on mismatches which will provide
more focused assertions and there will be less need for intervention on
snapshot updates.
This also gives more flexibility with placeholders
feat: stabilize `cargo update --precise <yanked>`
### What does this PR try to resolve?
Stabilize `cargo update --precise <yanked>`.
The cargo team has discussed the stabilization in the meeting today.
The interface of this is quite small and not as controversial as `--precise <pre-release>`,
since there is no version requirement operators involved.
We'd like to move forward and stabilize this part.
Note that `--precise <yanked>` allows using yanked version only for the specified package,
We leave the cascading allowing yanked versions (e.g. <https://github.com/rust-lang/cargo/issues/4225#issuecomment-1930353693>) as a future extension.
### How should we test and review this PR?
Check if any adjustment needed for warnings and CLI help text.
### Additional information
cc <https://github.com/rust-lang/cargo/issues/4225>.
Update openssl-src to 111.28.2+1.1.1w
### What does this PR try to resolve?
This PR is to fix the build of `loongarch64-unknown-linux-musl` target.
Update `openssl-src` from `111.28.1+1.1.1w` to `111.28.2+1.1.1w`.
### How should we test and review this PR?
Nothing special.
### Additional information
openssl-src diffs: cb7b3c8862...8c19f63843
Include `lints.rust.unexpected_cfgs.check-cfg` in the fingerprint
### What does this PR try to resolve?
When changing the `--check-cfg` args in the `lints.rust.unexpected_cfgs.check-cfg` lint config, the build should be restarted as the arguments we pass to the compiler change, and they can change the diagnostics output by generating new or removing some `unexpected_cfgs` warning(s).
### How should we test and review this PR?
Look at the before and after test (separate commit).
### Additional information
Similar to https://github.com/rust-lang/cargo/pull/13012 which did that for the declared features.
Contrary to that PR, I didn't add a new `DirtyReason` variant, since even the `[lints]` table didn't get one.
r? `@epage`
feat(test): Auto-redact elapsed time
By making this a redaction,
it automatically gets applied when generating the snapshot,
removing these extra steps
(that you likely only discover after the fact and have to debug)
chore: Update to snapbox 0.6
### What does this PR try to resolve?
This unblocks regex redactions which will help with `Finished in 3.45s` messages as well as maybe switching away from `compare.rs` generally.
### How should we test and review this PR?
### Additional information
Improve error description when deserializing partial field struct
### What does this PR try to resolve?
Fixes#13688
### How should we test and review this PR?
one commit add test, one commit fixed and update the test.
### Additional information