Repository: rust-lang/cargo (rust)

Issue:
Unhelpful error messages with env-vars that don't set all fields of a config struct
### Problem

I have been using the `gitoxide` integration for a while, via setting env-vars so it doesn't impact running the stable compiler:

```
CARGO_UNSTABLE_GITOXIDE_CHECKOUT=true
CARGO_UNSTABLE_GITOXIDE_FETCH=true
CARGO_UNSTABLE_GITOXIDE_INTERNAL_USE_GIT2=false
CARGO_UNSTABLE_GITOXIDE_SHALLOW_DEPS=true
CARGO_UNSTABLE_GITOXIDE_SHALLOW_INDEX=true
```

After updating to a version that includes https://github.com/rust-lang/cargo/pull/13592 any usage of cargo starts failing with

```console
> cargo test -- --ignored zero_byte
error: missing field `list_files`
```

which makes no mention of _where_ this field is missing

### Steps

```
> CARGO_UNSTABLE_GITOXIDE_FETCH=true cargo build
error: missing field `list_files`
```

### Possible Solution(s)

_No response_

### Notes

https://github.com/rust-lang/cargo/pull/13687 will likely fix this specific issue by making the fields of this struct default, but the general issue of the error message not having enough context will remain.

### Version

```text
cargo 1.79.0-nightly (a59aba136 2024-03-28)
release: 1.79.0-nightly
commit-hash: a59aba136aab5510c16b0750a36cbd9916f91796
commit-date: 2024-03-28
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: NixOS 23.11.0 [64-bit]
```


Pull request:
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


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 64dca07aa..e5611f1f0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -145,6 +145,12 @@ version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
 
+[[package]]
+name = "base64"
+version = "0.21.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+
 [[package]]
 name = "base64"
 version = "0.22.1"
@@ -271,7 +277,7 @@ dependencies = [
  "anstream",
  "anstyle",
  "anyhow",
- "base64",
+ "base64 0.22.1",
  "bytesize",
  "cargo-credential",
  "cargo-credential-libsecret",
@@ -959,9 +965,9 @@ checksum = "a2a2b11eda1d40935b26cf18f6833c526845ae8c41e58d09af6adeb6f0269183"
 
 [[package]]
 name = "fastrand"
-version = "2.1.0"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
+checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
 
 [[package]]
 name = "ff"
@@ -1085,9 +1091,9 @@ dependencies = [
 
 [[package]]
 name = "gix"
-version = "0.63.0"
+version = "0.62.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06"
+checksum = "5631c64fb4cd48eee767bf98a3cbc5c9318ef3bb71074d4c099a2371510282b6"
 dependencies = [
  "gix-actor",
  "gix-attributes",
@@ -1140,9 +1146,9 @@ dependencies = [
 
 [[package]]
 name = "gix-actor"
-version = "0.31.2"
+version = "0.31.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d69c59d392c7e6c94385b6fd6089d6df0fe945f32b4357687989f3aee253cd7f"
+checksum = "45c3a3bde455ad2ee8ba8a195745241ce0b770a8a26faae59fcf409d01b28c46"
 dependencies = [
  "bstr",
  "gix-date",
@@ -1189,9 +1195,9 @@ dependencies = [
 
 [[package]]
 name = "gix-command"
-version = "0.3.7"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c22e086314095c43ffe5cdc5c0922d5439da4fd726f3b0438c56147c34dc225"
+checksum = "f90009020dc4b3de47beed28e1334706e0a330ddd17f5cfeb097df3b15a54b77"
 dependencies = [
  "bstr",
  "gix-path",
@@ -1215,9 +1221,9 @@ dependencies = [
 
 [[package]]
 name = "gix-config"
-version = "0.37.0"
+version = "0.36.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840"
+checksum = "7580e05996e893347ad04e1eaceb92e1c0e6a3ffe517171af99bf6b6df0ca6e5"
 dependencies = [
  "bstr",
  "gix-config-value",
@@ -1266,9 +1272,9 @@ dependencies = [
 
 [[package]]
 name = "gix-date"
-version = "0.8.6"
+version = "0.8.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "367ee9093b0c2b04fd04c5c7c8b6a1082713534eab537597ae343663a518fa99"
+checksum = "180b130a4a41870edfbd36ce4169c7090bca70e195da783dea088dd973daa59c"
 dependencies = [
  "bstr",
  "itoa 1.0.11",
@@ -1278,9 +1284,9 @@ dependencies = [
 
 [[package]]
 name = "gix-diff"
-version = "0.44.0"
+version = "0.43.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40b9bd8b2d07b6675a840b56a6c177d322d45fa082672b0dad8f063b25baf0a4"
+checksum = "a5fbc24115b957346cd23fb0f47d830eb799c46c89cdcf2f5acc9bf2938c2d01"
 dependencies = [
  "bstr",
  "gix-hash",
@@ -1290,9 +1296,9 @@ dependencies = [
 
 [[package]]
 name = "gix-dir"
-version = "0.5.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60c99f8c545abd63abe541d20ab6cda347de406c0a3f1c80aadc12d9b0e94974"
+checksum = "3d6fcd56ffa1133f35525af890226ad0d3b2e607b4490360c94b1869e278eba3"
 dependencies = [
  "bstr",
  "gix-discover",
@@ -1310,9 +1316,9 @@ dependencies = [
 
 [[package]]
 name = "gix-discover"
-version = "0.32.0"
+version = "0.31.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf"
+checksum = "64bab49087ed3710caf77e473dc0efc54ca33d8ccc6441359725f121211482b1"
 dependencies = [
  "bstr",
  "dunce",
@@ -1326,9 +1332,9 @@ dependencies = [
 
 [[package]]
 name = "gix-features"
-version = "0.38.2"
+version = "0.38.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac7045ac9fe5f9c727f38799d002a7ed3583cd777e3322a7c4b43e3cf437dc69"
+checksum = "db4254037d20a247a0367aa79333750146a369719f0c6617fec4f5752cc62b37"
 dependencies = [
  "bytes",
  "crc32fast",
@@ -1348,9 +1354,9 @@ dependencies = [
 
 [[package]]
 name = "gix-filter"
-version = "0.11.2"
+version = "0.11.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00ce6ea5ac8fca7adbc63c48a1b9e0492c222c386aa15f513405f1003f2f4ab2"
+checksum = "5c0d1f01af62bfd2fb3dd291acc2b29d4ab3e96ad52a679174626508ce98ef12"
 dependencies = [
  "bstr",
  "encoding_rs",
@@ -1369,11 +1375,10 @@ dependencies = [
 
 [[package]]
 name = "gix-fs"
-version = "0.11.0"
+version = "0.10.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f78f7d6dcda7a5809efd73a33b145e3dce7421c460df21f32126f9732736b0c"
+checksum = "e2184c40e7910529677831c8b481acf788ffd92427ed21fad65b6aa637e631b8"
 dependencies = [
- "fastrand",
  "gix-features",
  "gix-utils",
 ]
@@ -1426,9 +1431,9 @@ dependencies = [
 
 [[package]]
 name = "gix-index"
-version = "0.33.0"
+version = "0.32.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d8c5a5f1c58edcbc5692b174cda2703aba82ed17d7176ff4c1752eb48b1b167"
+checksum = "881ab3b1fa57f497601a5add8289e72a7ae09471fc0b9bbe483b628ae8e418a1"
 dependencies = [
  "bitflags 2.5.0",
  "bstr",
@@ -1442,7 +1447,6 @@ dependencies = [
  "gix-object",
  "gix-traverse",
  "gix-utils",
- "gix-validate",
  "hashbrown",
  "itoa 1.0.11",
  "libc",
@@ -1454,9 +1458,9 @@ dependencies = [
 
 [[package]]
 name = "gix-lock"
-version = "14.0.0"
+version = "13.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3bc7fe297f1f4614774989c00ec8b1add59571dc9b024b4c00acb7dedd4e19d"
+checksum = "e7c359f81f01b8352063319bcb39789b7ea0887b406406381106e38c4a34d049"
 dependencies = [
  "gix-tempfile",
  "gix-utils",
@@ -1465,9 +1469,9 @@ dependencies = [
 
 [[package]]
 name = "gix-macros"
-version = "0.1.5"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "999ce923619f88194171a67fb3e6d613653b8d4d6078b529b15a765da0edcc17"
+checksum = "1dff438f14e67e7713ab9332f5fd18c8f20eb7eb249494f6c2bf170522224032"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1476,9 +1480,9 @@ dependencies = [
 
 [[package]]
 name = "gix-negotiate"
-version = "0.13.1"
+version = "0.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d57dec54544d155a495e01de947da024471e1825d7d3f2724301c07a310d6184"
+checksum = "54ba98f8c8c06870dfc167d192ca38a38261867b836cb89ac80bc9176dba975e"
 dependencies = [
  "bitflags 2.5.0",
  "gix-commitgraph",
@@ -1492,9 +1496,9 @@ dependencies = [
 
 [[package]]
 name = "gix-object"
-version = "0.42.2"
+version = "0.42.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fe2dc4a41191c680c942e6ebd630c8107005983c4679214fdb1007dcf5ae1df"
+checksum = "3d4f8efae72030df1c4a81d02dbe2348e748d9b9a11e108ed6efbd846326e051"
 dependencies = [
  "bstr",
  "gix-actor",
@@ -1511,9 +1515,9 @@ dependencies = [
 
 [[package]]
 name = "gix-odb"
-version = "0.61.0"
+version = "0.60.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e92b9790e2c919166865d0825b26cc440a387c175bed1b43a2fa99c0e9d45e98"
+checksum = "e8bbb43d2fefdc4701ffdf9224844d05b136ae1b9a73c2f90710c8dd27a93503"
 dependencies = [
  "arc-swap",
  "gix-date",
@@ -1531,9 +1535,9 @@ dependencies = [
 
 [[package]]
 name = "gix-pack"
-version = "0.51.0"
+version = "0.50.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a8da51212dbff944713edb2141ed7e002eea326b8992070374ce13a6cb610b3"
+checksum = "b58bad27c7677fa6b587aab3a1aca0b6c97373bd371a0a4290677c838c9bcaf1"
 dependencies = [
  "clru",
  "gix-chunk",
@@ -1588,9 +1592,9 @@ dependencies = [
 
 [[package]]
 name = "gix-pathspec"
-version = "0.7.5"
+version = "0.7.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a76cab098dc10ba2d89f634f66bf196dea4d7db4bf10b75c7a9c201c55a2ee19"
+checksum = "ea9f934a111e0efdf93ae06e3648427e60e783099fbebd6a53a7a2ffb10a1e65"
 dependencies = [
  "bitflags 2.5.0",
  "bstr",
@@ -1603,9 +1607,9 @@ dependencies = [
 
 [[package]]
 name = "gix-prompt"
-version = "0.8.5"
+version = "0.8.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fddabbc7c51c241600ab3c4623b19fa53bde7c1a2f637f61043ed5fcadf000cc"
+checksum = "f5325eb17ce7b5e5d25dec5c2315d642a09d55b9888b3bf46b7d72e1621a55d8"
 dependencies = [
  "gix-command",
  "gix-config-value",
@@ -1616,9 +1620,9 @@ dependencies = [
 
 [[package]]
 name = "gix-protocol"
-version = "0.45.1"
+version = "0.45.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c140d4c6d209048826bad78f021a01b612830f89da356efeb31afe8957f8bee"
+checksum = "aed3bb6179835a3250403baa9d7022579e559fc45f2efc416d9de1a14b5acf11"
 dependencies = [
  "bstr",
  "gix-credentials",
@@ -1645,9 +1649,9 @@ dependencies = [
 
 [[package]]
 name = "gix-ref"
-version = "0.44.0"
+version = "0.43.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b36752b448647acd59c9668fdd830b16d07db1e6d9c3b3af105c1605a6e23d9"
+checksum = "fd4aba68b925101cb45d6df328979af0681364579db889098a0de75b36c77b65"
 dependencies = [
  "gix-actor",
  "gix-date",
@@ -1681,9 +1685,9 @@ dependencies = [
 
 [[package]]
 name = "gix-revision"
-version = "0.27.1"
+version = "0.27.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63e08f8107ed1f93a83bcfbb4c38084c7cb3f6cd849793f1d5eec235f9b13b2b"
+checksum = "9e34196e1969bd5d36e2fbc4467d893999132219d503e23474a8ad2b221cb1e8"
 dependencies = [
  "bstr",
  "gix-date",
@@ -1697,9 +1701,9 @@ dependencies = [
 
 [[package]]
 name = "gix-revwalk"
-version = "0.13.1"
+version = "0.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4181db9cfcd6d1d0fd258e91569dbb61f94cb788b441b5294dd7f1167a3e788f"
+checksum = "e0a7d393ae814eeaae41a333c0ff684b243121cc61ccdc5bbe9897094588047d"
 dependencies = [
  "gix-commitgraph",
  "gix-date",
@@ -1724,9 +1728,9 @@ dependencies = [
 
 [[package]]
 name = "gix-submodule"
-version = "0.11.0"
+version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "921cd49924ac14b6611b22e5fb7bbba74d8780dc7ad26153304b64d1272460ac"
+checksum = "4fb7ea05666362472fecd44c1fc35fe48a5b9b841b431cc4f85b95e6f20c23ec"
 dependencies = [
  "bstr",
  "gix-config",
@@ -1739,9 +1743,9 @@ dependencies = [
 
 [[package]]
 name = "gix-tempfile"
-version = "14.0.0"
+version = "13.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3b0e276cd08eb2a22e9f286a4f13a222a01be2defafa8621367515375644b99"
+checksum = "a761d76594f4443b675e85928e4902dec333273836bd386906f01e7e346a0d11"
 dependencies = [
  "gix-fs",
  "libc",
@@ -1758,11 +1762,11 @@ checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e"
 
 [[package]]
 name = "gix-transport"
-version = "0.42.1"
+version = "0.42.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb0ffa5f869977f5b9566399154055902f05d7e85c787d5eacf551acdd0c4adf"
+checksum = "9d2f783b2fe86bf2a8cf1f3b8669d65b01ab4932f32cc0101d3893e1b16a3bd6"
 dependencies = [
- "base64",
+ "base64 0.21.7",
  "bstr",
  "curl",
  "gix-command",
@@ -1777,9 +1781,9 @@ dependencies = [
 
 [[package]]
 name = "gix-traverse"
-version = "0.39.1"
+version = "0.39.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f20cb69b63eb3e4827939f42c05b7756e3488ef49c25c412a876691d568ee2a0"
+checksum = "f4029ec209b0cc480d209da3837a42c63801dd8548f09c1f4502c60accb62aeb"
 dependencies = [
  "bitflags 2.5.0",
  "gix-commitgraph",
@@ -1819,9 +1823,9 @@ dependencies = [
 
 [[package]]
 name = "gix-validate"
-version = "0.8.5"
+version = "0.8.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82c27dd34a49b1addf193c92070bcbf3beaf6e10f16a78544de6372e146a0acf"
+checksum = "e39fc6e06044985eac19dd34d474909e517307582e462b2eb4c8fa51b6241545"
 dependencies = [
  "bstr",
  "thiserror",
@@ -1829,9 +1833,9 @@ dependencies = [
 
 [[package]]
 name = "gix-worktree"
-version = "0.34.0"
+version = "0.33.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53f6b7de83839274022aff92157d7505f23debf739d257984a300a35972ca94e"
+checksum = "f06ca5dd164678914fc9280ba9d1ffeb66499ccc16ab1278c513828beee88401"
 dependencies = [
  "bstr",
  "gix-attributes",
@@ -1843,7 +1847,6 @@ dependencies = [
  "gix-index",
  "gix-object",
  "gix-path",
- "gix-validate",
 ]
 
 [[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 3ce3a6701..2e894a4c7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -46,7 +46,7 @@ filetime = "0.2.23"
 flate2 = { version = "1.0.30", default-features = false, features = ["zlib"] }
 git2 = "0.18.3"
 git2-curl = "0.19.0"
-gix = { version = "0.63.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision", "parallel", "dirwalk"] }
+gix = { version = "0.62.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision", "parallel", "dirwalk"] }
 glob = "0.3.1"
 handlebars = { version = "5.1.2", features = ["dir_source"] }
 hex = "0.4.3"
diff --git a/crates/cargo-util/src/paths.rs b/crates/cargo-util/src/paths.rs
index 59e812f3a..aed6ce3b1 100644
--- a/crates/cargo-util/src/paths.rs
+++ b/crates/cargo-util/src/paths.rs
@@ -517,57 +517,24 @@ fn _remove_dir(p: &Path) -> Result<()> {
 ///
 /// If the file is readonly, this will attempt to change the permissions to
 /// force the file to be deleted.
-/// On Windows, if the file is a symlink to a directory, this will attempt to remove
-/// the symlink itself.
 pub fn remove_file<P: AsRef<Path>>(p: P) -> Result<()> {
     _remove_file(p.as_ref())
 }
 
 fn _remove_file(p: &Path) -> Result<()> {
-    // For Windows, we need to check if the file is a symlink to a directory
-    // and remove the symlink itself by calling `remove_dir` instead of
-    // `remove_file`.
-    #[cfg(target_os = "windows")]
-    {
-        use std::os::windows::fs::FileTypeExt;
-        let metadata = symlink_metadata(p)?;
-        let file_type = metadata.file_type();
-        if file_type.is_symlink_dir() {
-            return remove_symlink_dir_with_permission_check(p);
-        }
-    }
-
-    remove_file_with_permission_check(p)
-}
-
-#[cfg(target_os = "windows")]
-fn remove_symlink_dir_with_permission_check(p: &Path) -> Result<()> {
-    remove_with_permission_check(fs::remove_dir, p)
-        .with_context(|| format!("failed to remove symlink dir `{}`", p.display()))
-}
-
-fn remove_file_with_permission_check(p: &Path) -> Result<()> {
-    remove_with_permission_check(fs::remove_file, p)
-        .with_context(|| format!("failed to remove file `{}`", p.display()))
-}
+    let mut err = match fs::remove_file(p) {
+        Ok(()) => return Ok(()),
+        Err(e) => e,
+    };
 
-fn remove_with_permission_check<F, P>(remove_func: F, p: P) -> io::Result<()>
-where
-    F: Fn(P) -> io::Result<()>,
-    P: AsRef<Path> + Clone,
-{
-    match remove_func(p.clone()) {
-        Ok(()) => Ok(()),
-        Err(e) => {
-            if e.kind() == io::ErrorKind::PermissionDenied
-                && set_not_readonly(p.as_ref()).unwrap_or(false)
-            {
-                remove_func(p)
-            } else {
-                Err(e)
-            }
+    if err.kind() == io::ErrorKind::PermissionDenied && set_not_readonly(p).unwrap_or(false) {
+        match fs::remove_file(p) {
+            Ok(()) => return Ok(()),
+            Err(e) => err = e,
         }
     }
+
+    Err(err).with_context(|| format!("failed to remove file `{}`", p.display()))
 }
 
 fn set_not_readonly(p: &Path) -> io::Result<bool> {
@@ -941,50 +908,4 @@ mod tests {
             );
         }
     }
-
-    #[test]
-    #[cfg(windows)]
-    fn test_remove_symlink_dir() {
-        use super::*;
-        use std::fs;
-        use std::os::windows::fs::symlink_dir;
-
-        let tmpdir = tempfile::tempdir().unwrap();
-        let dir_path = tmpdir.path().join("testdir");
-        let symlink_path = tmpdir.path().join("symlink");
-
-        fs::create_dir(&dir_path).unwrap();
-
-        symlink_dir(&dir_path, &symlink_path).expect("failed to create symlink");
-
-        assert!(symlink_path.exists());
-
-        assert!(remove_file(symlink_path.clone()).is_ok());
-
-        assert!(!symlink_path.exists());
-        assert!(dir_path.exists());
-    }
-
-    #[test]
-    #[cfg(windows)]
-    fn test_remove_symlink_file() {
-        use super::*;
-        use std::fs;
-        use std::os::windows::fs::symlink_file;
-
-        let tmpdir = tempfile::tempdir().unwrap();
-        let file_path = tmpdir.path().join("testfile");
-        let symlink_path = tmpdir.path().join("symlink");
-
-        fs::write(&file_path, b"test").unwrap();
-
-        symlink_file(&file_path, &symlink_path).expect("failed to create symlink");
-
-        assert!(symlink_path.exists());
-
-        assert!(remove_file(symlink_path.clone()).is_ok());
-
-        assert!(!symlink_path.exists());
-        assert!(file_path.exists());
-    }
 }
diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs
index ed4b04dc2..e9358bdf9 100644
--- a/src/cargo/core/compiler/build_context/target_info.rs
+++ b/src/cargo/core/compiler/build_context/target_info.rs
@@ -152,7 +152,6 @@ impl TargetInfo {
     /// invocation is cached by [`Rustc::cached_output`].
     ///
     /// Search `Tricky` to learn why querying `rustc` several times is needed.
-    #[tracing::instrument(skip_all)]
     pub fn new(
         gctx: &GlobalContext,
         requested_kinds: &[CompileKind],
@@ -879,7 +878,6 @@ pub struct RustcTargetData<'gctx> {
 }
 
 impl<'gctx> RustcTargetData<'gctx> {
-    #[tracing::instrument(skip_all)]
     pub fn new(
         ws: &Workspace<'gctx>,
         requested_kinds: &[CompileKind],
diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs
index 5e054794a..8cec4a489 100644
--- a/src/cargo/core/package.rs
+++ b/src/cargo/core/package.rs
@@ -654,7 +654,6 @@ impl<'a, 'gctx> Downloads<'a, 'gctx> {
     /// Returns `None` if the package is queued up for download and will
     /// eventually be returned from `wait_for_download`. Returns `Some(pkg)` if
     /// the package is ready and doesn't need to be downloaded.
-    #[tracing::instrument(skip_all)]
     pub fn start(&mut self, id: PackageId) -> CargoResult<Option<&'a Package>> {
         self.start_inner(id)
             .with_context(|| format!("failed to download `{}`", id))
@@ -794,7 +793,6 @@ impl<'a, 'gctx> Downloads<'a, 'gctx> {
     /// # Panics
     ///
     /// This function will panic if there are no remaining downloads.
-    #[tracing::instrument(skip_all)]
     pub fn wait(&mut self) -> CargoResult<&'a Package> {
         let (dl, data) = loop {
             assert_eq!(self.pending.len(), self.pending_ids.len());
diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs
index fc0ac5931..f349395b5 100644
--- a/src/cargo/ops/cargo_new.rs
+++ b/src/cargo/ops/cargo_new.rs
@@ -876,7 +876,7 @@ fn main() {
 "
         } else {
             b"\
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs
index 66fb11a30..8d84c2763 100644
--- a/src/cargo/sources/git/utils.rs
+++ b/src/cargo/sources/git/utils.rs
@@ -1417,14 +1417,6 @@ fn github_fast_path(
                         return Ok(FastPathRev::UpToDate);
                     }
                 }
-                // If `rev` is a full commit hash, the only thing it can resolve
-                // to is itself. Don't bother talking to GitHub in that case
-                // either. (This ensures that we always attempt to fetch the
-                // commit directly even if we can't reach the GitHub API.)
-                if let Ok(oid) = rev.parse() {
-                    debug!("github fast path is already a full commit hash {rev}");
-                    return Ok(FastPathRev::NeedsFetch(oid));
-                }
                 rev
             } else {
                 debug!("can't use github fast path with `rev = \"{}\"`", rev);
diff --git a/src/cargo/util/context/de.rs b/src/cargo/util/context/de.rs
index 18a84823b..e84322422 100644
--- a/src/cargo/util/context/de.rs
+++ b/src/cargo/util/context/de.rs
@@ -35,7 +35,7 @@ macro_rules! deserialize_method {
                 .ok_or_else(|| ConfigError::missing(&self.key))?;
             let Value { val, definition } = v;
             let res: Result<V::Value, ConfigError> = visitor.$visit(val);
-            res.map_err(|e| e.with_key_context(&self.key, definition))
+            res.map_err(|e| e.with_key_context(&self.key, Some(definition)))
         }
     };
 }
@@ -60,7 +60,7 @@ impl<'de, 'gctx> de::Deserializer<'de> for Deserializer<'gctx> {
                 CV::Boolean(b, def) => (visitor.visit_bool(b), def),
             };
             let (res, def) = res;
-            return res.map_err(|e| e.with_key_context(&self.key, def));
+            return res.map_err(|e| e.with_key_context(&self.key, Some(def)));
         }
         Err(ConfigError::missing(&self.key))
     }
@@ -178,7 +178,7 @@ impl<'de, 'gctx> de::Deserializer<'de> for Deserializer<'gctx> {
         let Value { val, definition } = value;
         visitor
             .visit_enum(val.into_deserializer())
-            .map_err(|e: ConfigError| e.with_key_context(&self.key, definition))
+            .map_err(|e: ConfigError| e.with_key_context(&self.key, Some(definition)))
     }
 
     // These aren't really supported, yet.
@@ -345,11 +345,25 @@ impl<'de, 'gctx> de::MapAccess<'de> for ConfigMapAccess<'gctx> {
             field.replace('-', "_").starts_with(&env_prefix)
         });
 
-        let result = seed.deserialize(Deserializer {
-            gctx: self.de.gctx,
-            key: self.de.key.clone(),
-            env_prefix_ok,
-        });
+        let result = seed
+            .deserialize(Deserializer {
+                gctx: self.de.gctx,
+                key: self.de.key.clone(),
+                env_prefix_ok,
+            })
+            .map_err(|e| {
+                if !e.is_missing_field() {
+                    return e;
+                }
+                e.with_key_context(
+                    &self.de.key,
+                    self.de
+                        .gctx
+                        .get_cv_with_env(&self.de.key)
+                        .ok()
+                        .and_then(|cv| cv.map(|cv| cv.get_definition().clone())),
+                )
+            });
         self.de.key.pop();
         result
     }
@@ -486,7 +500,7 @@ impl<'de, 'gctx> de::MapAccess<'de> for ValueDeserializer<'gctx> {
             if let Some(de) = &self.de {
                 return seed
                     .deserialize(de.clone())
-                    .map_err(|e| e.with_key_context(&de.key, self.definition.clone()));
+                    .map_err(|e| e.with_key_context(&de.key, Some(self.definition.clone())));
             } else {
                 return seed
                     .deserialize(self.str_value.as_ref().unwrap().clone().into_deserializer());
diff --git a/src/cargo/util/context/mod.rs b/src/cargo/util/context/mod.rs
index 914d57f21..2ce4f2ace 100644
--- a/src/cargo/util/context/mod.rs
+++ b/src/cargo/util/context/mod.rs
@@ -2030,6 +2030,10 @@ impl ConfigError {
         }
     }
 
+    fn is_missing_field(&self) -> bool {
+        self.error.downcast_ref::<MissingField>().is_some()
+    }
+
     fn missing(key: &ConfigKey) -> ConfigError {
         ConfigError {
             error: anyhow!("missing config key `{}`", key),
@@ -2037,11 +2041,11 @@ impl ConfigError {
         }
     }
 
-    fn with_key_context(self, key: &ConfigKey, definition: Definition) -> ConfigError {
+    fn with_key_context(self, key: &ConfigKey, definition: Option<Definition>) -> ConfigError {
         ConfigError {
             error: anyhow::Error::from(self)
                 .context(format!("could not load config key `{}`", key)),
-            definition: Some(definition),
+            definition: definition,
         }
     }
 }
@@ -2062,6 +2066,17 @@ impl fmt::Display for ConfigError {
     }
 }
 
+#[derive(Debug)]
+struct MissingField(String);
+
+impl fmt::Display for MissingField {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "missing field `{}`", self.0)
+    }
+}
+
+impl std::error::Error for MissingField {}
+
 impl serde::de::Error for ConfigError {
     fn custom<T: fmt::Display>(msg: T) -> Self {
         ConfigError {
@@ -2069,6 +2084,13 @@ impl serde::de::Error for ConfigError {
             definition: None,
         }
     }
+
+    fn missing_field(field: &'static str) -> Self {
+        ConfigError {
+            error: anyhow::Error::new(MissingField(field.to_string())),
+            definition: None,
+        }
+    }
 }
 
 impl From<anyhow::Error> for ConfigError {
@@ -2111,6 +2133,16 @@ impl fmt::Debug for ConfigValue {
 }
 
 impl ConfigValue {
+    fn get_definition(&self) -> &Definition {
+        match self {
+            CV::Boolean(_, def)
+            | CV::Integer(_, def)
+            | CV::String(_, def)
+            | CV::List(_, def)
+            | CV::Table(_, def) => def,
+        }
+    }
+
     fn from_toml(def: Definition, toml: toml::Value) -> CargoResult<ConfigValue> {
         match toml {
             toml::Value::String(val) => Ok(CV::String(val, def)),
diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md
index 4fdde9311..d809354a4 100644
--- a/src/doc/src/reference/config.md
+++ b/src/doc/src/reference/config.md
@@ -170,7 +170,7 @@ rustflags = ["…", "…"]  # custom flags for `rustc`
 [target.<triple>.<links>] # `links` build script override
 rustc-link-lib = ["foo"]
 rustc-link-search = ["/path/to/foo"]
-rustc-flags = "-L /some/path"
+rustc-flags = ["-L", "/some/path"]
 rustc-cfg = ['key="value"']
 rustc-env = {key = "value"}
 rustc-cdylib-link-arg = ["…"]


Test patch:
diff --git a/tests/testsuite/cargo_init/auto_git/out/src/lib.rs b/tests/testsuite/cargo_init/auto_git/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/auto_git/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/auto_git/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/formats_source/out/src/lib.rs b/tests/testsuite/cargo_init/formats_source/out/src/lib.rs
index 78ba4fec6..3b9acffd5 100644
--- a/tests/testsuite/cargo_init/formats_source/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/formats_source/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
   left + right
 }
 
diff --git a/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs b/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/fossil_autodetect/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs b/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs b/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/git_ignore_exists_no_conflicting_entries/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs b/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/ignores_failure_to_format_source/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs b/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs
+++ b/tests/testsuite/cargo_init/inherit_workspace_package_table/in/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs b/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/inherit_workspace_package_table/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs b/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/mercurial_autodetect/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs b/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/simple_git/out/src/lib.rs b/tests/testsuite/cargo_init/simple_git/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/simple_git/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/simple_git/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs b/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/simple_git_ignore_exists/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs b/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/simple_hg/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs b/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/simple_hg_ignore_exists/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs b/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs
+++ b/tests/testsuite/cargo_init/simple_lib/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/add_members_to_non_workspace/out/bar/src/lib.rs b/tests/testsuite/cargo_new/add_members_to_non_workspace/out/bar/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/add_members_to_non_workspace/out/bar/src/lib.rs
+++ b/tests/testsuite/cargo_new/add_members_to_non_workspace/out/bar/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/in/src/lib.rs b/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/in/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/in/src/lib.rs
+++ b/tests/testsuite/cargo_new/add_members_to_workspace_with_exclude_list/in/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/add_members_to_workspace_without_members/out/bar/src/lib.rs b/tests/testsuite/cargo_new/add_members_to_workspace_without_members/out/bar/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/add_members_to_workspace_without_members/out/bar/src/lib.rs
+++ b/tests/testsuite/cargo_new/add_members_to_workspace_without_members/out/bar/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_lints/in/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_lints/in/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_lints/in/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_lints/in/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_lints/out/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_lints/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_lints/out/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_lints/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table.in/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table.in/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_package_table.in/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_package_table.in/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table/out/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_package_table/out/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_package_table/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/out/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/out/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_edition/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/out/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/out/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_with_registry/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/in/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/out/src/lib.rs b/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/out/src/lib.rs
+++ b/tests/testsuite/cargo_new/inherit_workspace_package_table_without_version/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/in/src/lib.rs b/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/in/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/in/src/lib.rs
+++ b/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/in/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/out/src/lib.rs b/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/out/src/lib.rs
index b93cf3ffd..7d12d9af8 100644
--- a/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/out/src/lib.rs
+++ b/tests/testsuite/cargo_new/not_inherit_workspace_package_table_if_not_members/out/src/lib.rs
@@ -1,4 +1,4 @@
-pub fn add(left: u64, right: u64) -> u64 {
+pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs
index 8cd86ae0a..6f0b262db 100644
--- a/tests/testsuite/config.rs
+++ b/tests/testsuite/config.rs
@@ -1863,3 +1863,48 @@ fn trim_paths_parsing() {
     let trim_paths: TomlTrimPaths = gctx.get("profile.dev.trim-paths").unwrap();
     assert_eq!(trim_paths, expected, "failed to parse {val}");
 }
+
+#[cargo_test]
+fn missing_fields() {
+    #[derive(Deserialize, Default, Debug)]
+    struct Foo {
+        bar: Bar,
+    }
+
+    #[derive(Deserialize, Default, Debug)]
+    struct Bar {
+        bax: bool,
+        baz: bool,
+    }
+
+    let gctx = GlobalContextBuilder::new()
+        .env("CARGO_FOO_BAR_BAZ", "true")
+        .build();
+    assert_error(
+        gctx.get::<Foo>("foo").unwrap_err(),
+        "\
+could not load config key `foo.bar`
+
+Caused by:
+  missing field `bax`",
+    );
+    let gctx: GlobalContext = GlobalContextBuilder::new()
+        .env("CARGO_FOO_BAR_BAZ", "true")
+        .env("CARGO_FOO_BAR_BAX", "true")
+        .build();
+    let foo = gctx.get::<Foo>("foo").unwrap();
+    assert_eq!(foo.bar.bax, true);
+    assert_eq!(foo.bar.baz, true);
+
+    let gctx: GlobalContext = GlobalContextBuilder::new()
+        .config_arg("foo.bar.baz=true")
+        .build();
+    assert_error(
+        gctx.get::<Foo>("foo").unwrap_err(),
+        "\
+error in --config cli option: could not load config key `foo.bar`
+
+Caused by:
+  missing field `bax`",
+    );
+}
diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs
index d7a8ab4f7..ff80f4b6a 100644
--- a/tests/testsuite/new.rs
+++ b/tests/testsuite/new.rs
@@ -42,7 +42,7 @@ fn simple_lib() {
     let contents = fs::read_to_string(&lib).unwrap();
     assert_eq!(
         contents,
-        r#"pub fn add(left: u64, right: u64) -> u64 {
+        r#"pub fn add(left: usize, right: usize) -> usize {
     left + right
 }
 
diff --git a/tests/testsuite/progress.rs b/tests/testsuite/progress.rs
index 0248a040d..ffc00d50d 100644
--- a/tests/testsuite/progress.rs
+++ b/tests/testsuite/progress.rs
@@ -70,7 +70,10 @@ fn bad_progress_config_missing_when() {
         .with_status(101)
         .with_stderr(
             "\
-error: missing field `when`
+error: error in [..]: could not load config key `term.progress`
+
+Caused by:
+  missing field `when`
 ",
         )
         .run();
diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs
index 1bb352e14..a32cb6d0e 100644
--- a/tests/testsuite/test.rs
+++ b/tests/testsuite/test.rs
@@ -5085,7 +5085,7 @@ fn cargo_test_set_out_dir_env_var() {
         .file(
             "src/lib.rs",
             r#"
-                pub fn add(left: u64, right: u64) -> u64 {
+                pub fn add(left: usize, right: usize) -> usize {
                     left + right
                 }
             "#,