cargo clean: Add target directory validation#16712
Conversation
|
I also noticed that if a file path is passed via |
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
94c1489 to
94a4d66
Compare
|
thanks for the review :) Also I noticed that the CI keeps failing in something totally unrelated. I see it's happening in other PRs as well. Any idea why this is happening? |
Feel free to rebase onto master! |
94a4d66 to
c6cdaa1
Compare
This comment has been minimized.
This comment has been minimized.
f72fbd1 to
23c225b
Compare
|
Added a check(and test) to make sure |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
I knew we discussed this during a meeting last year, but for a behavior change it is still better to have a formal record and give members time to think about it offline. Hence @rfcbot fcp merge cargo This implements the target-dir validation described in #9192 (comment).
|
|
Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
From #9192 (comment)
What led to deciding in the direction of the future-incompat warning? |
For myself, to be conservative. I remembered rust-analyzer may create target-dir before running any |
|
@TanmayArya-1p While this is still in FCP, we were discussing whether the target-dir-is-file check can be a separate commit, or even a separate PR. That one turns out to be less controversial within the Cargo team. |
|
cool, i'll open another pr for the file validation. |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
…16878) ### What does this PR try to resolve? #16712 added some additional tests to `clean.rs` but did not add them to `clean_new_layout.rs` (which mirrors `clean.rs` with `-Zbuild-dir-new-layout` enabled) While these tests do not depend on the new build-dir layout, #16807 renames `clean.rs` to `clean_legacy_layout.rs` and `clean_new_layout.rs` to `clean.rs`. Having the tests be in both makes the switch easier and results in less diffs. I pulled this out into its own PR as the stabilization has grown pretty large. ### How to test and review this PR? `cargo test clean`
Update cargo submodule 26 commits in eb94155a9a60943bd7b1cb04abec42f5d0de6ddc..3bf1388b8823ec4eab622340036593381d8871aa 2026-04-09 13:10:20 +0000 to 2026-04-17 23:27:26 +0000 - Add global HTTP timeout tracking to http_async (rust-lang/cargo#16903) - feat(config): Stabilize `resolver.lockfile-path` config (rust-lang/cargo#16694) - chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#16897) - fix: rebuild rustdoc json for different versions of a same crate (rust-lang/cargo#16773) - Add effective_url to http_async (rust-lang/cargo#16899) - Make crate downloads process as a queue rather than a stack (rust-lang/cargo#16898) - fix: sparse registry fetch progress reporting (rust-lang/cargo#16900) - chore: bump to 0.98.0; update changelog (rust-lang/cargo#16892) - docs(semver-check): update diagnostics to Rust 1.95 (rust-lang/cargo#16895) - docs(ref): Better highlight 'package --list' for include/exclude (rust-lang/cargo#16891) - docs: `include` doesnt apply gitignore from repo (rust-lang/cargo#16890) - fix: Update `bash` and `zsh` Autocompletion Documents to add `-m` (rust-lang/cargo#16888) - Add `-m` shorthand for `--manifest-path` (rust-lang/cargo#16858) - Fix a typo (rust-lang/cargo#16885) - Always take a shared lock on `.cargo-lock` (rust-lang/cargo#16886) - fix(toml): Teach users how to pin edition (rust-lang/cargo#16851) - fix: Prefer defined lint levels over default (rust-lang/cargo#16879) - chore(deps): bump rand from 0.10.0 to 0.10.1 (rust-lang/cargo#16883) - fix(lints): Ignore unused_crate_dependencies status (rust-lang/cargo#16877) - Copy cargo clean target-dir validation tests to clean_new_layout.rs (rust-lang/cargo#16878) - cargo clean: Add target directory validation (rust-lang/cargo#16712) - Docs: "api" in the configuration should not include a trailing slash (rust-lang/cargo#16869) - fix(core): use `closest_msg` to suggest similar member name for mistyped `-p` (rust-lang/cargo#16844) - chore(ci): Pin GitHub Actions to commit SHAs (rust-lang/cargo#16868) - chore(ci): Update `actions/checkout` from v5 to v6 (rust-lang/cargo#16867) - Add test for cargo install with github fastpath (rust-lang/cargo#16866) r? ghost
Update cargo submodule 28 commits in eb94155a9a60943bd7b1cb04abec42f5d0de6ddc..7ecf0285ebb408d596e4a8ac76a0980d8edb7005 2026-04-09 13:10:20 +0000 to 2026-04-18 15:34:11 +0000 - fix: use `portable-atomic` for 64-bit atomics (rust-lang/cargo#16906) - fix: rename incorrectly documented target-spec-json to json-target-sp… (rust-lang/cargo#16905) - Add global HTTP timeout tracking to http_async (rust-lang/cargo#16903) - feat(config): Stabilize `resolver.lockfile-path` config (rust-lang/cargo#16694) - chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#16897) - fix: rebuild rustdoc json for different versions of a same crate (rust-lang/cargo#16773) - Add effective_url to http_async (rust-lang/cargo#16899) - Make crate downloads process as a queue rather than a stack (rust-lang/cargo#16898) - fix: sparse registry fetch progress reporting (rust-lang/cargo#16900) - chore: bump to 0.98.0; update changelog (rust-lang/cargo#16892) - docs(semver-check): update diagnostics to Rust 1.95 (rust-lang/cargo#16895) - docs(ref): Better highlight 'package --list' for include/exclude (rust-lang/cargo#16891) - docs: `include` doesnt apply gitignore from repo (rust-lang/cargo#16890) - fix: Update `bash` and `zsh` Autocompletion Documents to add `-m` (rust-lang/cargo#16888) - Add `-m` shorthand for `--manifest-path` (rust-lang/cargo#16858) - Fix a typo (rust-lang/cargo#16885) - Always take a shared lock on `.cargo-lock` (rust-lang/cargo#16886) - fix(toml): Teach users how to pin edition (rust-lang/cargo#16851) - fix: Prefer defined lint levels over default (rust-lang/cargo#16879) - chore(deps): bump rand from 0.10.0 to 0.10.1 (rust-lang/cargo#16883) - fix(lints): Ignore unused_crate_dependencies status (rust-lang/cargo#16877) - Copy cargo clean target-dir validation tests to clean_new_layout.rs (rust-lang/cargo#16878) - cargo clean: Add target directory validation (rust-lang/cargo#16712) - Docs: "api" in the configuration should not include a trailing slash (rust-lang/cargo#16869) - fix(core): use `closest_msg` to suggest similar member name for mistyped `-p` (rust-lang/cargo#16844) - chore(ci): Pin GitHub Actions to commit SHAs (rust-lang/cargo#16868) - chore(ci): Update `actions/checkout` from v5 to v6 (rust-lang/cargo#16867) - Add test for cargo install with github fastpath (rust-lang/cargo#16866)
Update cargo submodule 28 commits in eb94155a9a60943bd7b1cb04abec42f5d0de6ddc..7ecf0285ebb408d596e4a8ac76a0980d8edb7005 2026-04-09 13:10:20 +0000 to 2026-04-18 15:34:11 +0000 - fix: use `portable-atomic` for 64-bit atomics (rust-lang/cargo#16906) - fix: rename incorrectly documented target-spec-json to json-target-sp… (rust-lang/cargo#16905) - Add global HTTP timeout tracking to http_async (rust-lang/cargo#16903) - feat(config): Stabilize `resolver.lockfile-path` config (rust-lang/cargo#16694) - chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#16897) - fix: rebuild rustdoc json for different versions of a same crate (rust-lang/cargo#16773) - Add effective_url to http_async (rust-lang/cargo#16899) - Make crate downloads process as a queue rather than a stack (rust-lang/cargo#16898) - fix: sparse registry fetch progress reporting (rust-lang/cargo#16900) - chore: bump to 0.98.0; update changelog (rust-lang/cargo#16892) - docs(semver-check): update diagnostics to Rust 1.95 (rust-lang/cargo#16895) - docs(ref): Better highlight 'package --list' for include/exclude (rust-lang/cargo#16891) - docs: `include` doesnt apply gitignore from repo (rust-lang/cargo#16890) - fix: Update `bash` and `zsh` Autocompletion Documents to add `-m` (rust-lang/cargo#16888) - Add `-m` shorthand for `--manifest-path` (rust-lang/cargo#16858) - Fix a typo (rust-lang/cargo#16885) - Always take a shared lock on `.cargo-lock` (rust-lang/cargo#16886) - fix(toml): Teach users how to pin edition (rust-lang/cargo#16851) - fix: Prefer defined lint levels over default (rust-lang/cargo#16879) - chore(deps): bump rand from 0.10.0 to 0.10.1 (rust-lang/cargo#16883) - fix(lints): Ignore unused_crate_dependencies status (rust-lang/cargo#16877) - Copy cargo clean target-dir validation tests to clean_new_layout.rs (rust-lang/cargo#16878) - cargo clean: Add target directory validation (rust-lang/cargo#16712) - Docs: "api" in the configuration should not include a trailing slash (rust-lang/cargo#16869) - fix(core): use `closest_msg` to suggest similar member name for mistyped `-p` (rust-lang/cargo#16844) - chore(ci): Pin GitHub Actions to commit SHAs (rust-lang/cargo#16868) - chore(ci): Update `actions/checkout` from v5 to v6 (rust-lang/cargo#16867) - Add test for cargo install with github fastpath (rust-lang/cargo#16866)
Update cargo submodule 28 commits in eb94155a9a60943bd7b1cb04abec42f5d0de6ddc..7ecf0285ebb408d596e4a8ac76a0980d8edb7005 2026-04-09 13:10:20 +0000 to 2026-04-18 15:34:11 +0000 - fix: use `portable-atomic` for 64-bit atomics (rust-lang/cargo#16906) - fix: rename incorrectly documented target-spec-json to json-target-sp… (rust-lang/cargo#16905) - Add global HTTP timeout tracking to http_async (rust-lang/cargo#16903) - feat(config): Stabilize `resolver.lockfile-path` config (rust-lang/cargo#16694) - chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#16897) - fix: rebuild rustdoc json for different versions of a same crate (rust-lang/cargo#16773) - Add effective_url to http_async (rust-lang/cargo#16899) - Make crate downloads process as a queue rather than a stack (rust-lang/cargo#16898) - fix: sparse registry fetch progress reporting (rust-lang/cargo#16900) - chore: bump to 0.98.0; update changelog (rust-lang/cargo#16892) - docs(semver-check): update diagnostics to Rust 1.95 (rust-lang/cargo#16895) - docs(ref): Better highlight 'package --list' for include/exclude (rust-lang/cargo#16891) - docs: `include` doesnt apply gitignore from repo (rust-lang/cargo#16890) - fix: Update `bash` and `zsh` Autocompletion Documents to add `-m` (rust-lang/cargo#16888) - Add `-m` shorthand for `--manifest-path` (rust-lang/cargo#16858) - Fix a typo (rust-lang/cargo#16885) - Always take a shared lock on `.cargo-lock` (rust-lang/cargo#16886) - fix(toml): Teach users how to pin edition (rust-lang/cargo#16851) - fix: Prefer defined lint levels over default (rust-lang/cargo#16879) - chore(deps): bump rand from 0.10.0 to 0.10.1 (rust-lang/cargo#16883) - fix(lints): Ignore unused_crate_dependencies status (rust-lang/cargo#16877) - Copy cargo clean target-dir validation tests to clean_new_layout.rs (rust-lang/cargo#16878) - cargo clean: Add target directory validation (rust-lang/cargo#16712) - Docs: "api" in the configuration should not include a trailing slash (rust-lang/cargo#16869) - fix(core): use `closest_msg` to suggest similar member name for mistyped `-p` (rust-lang/cargo#16844) - chore(ci): Pin GitHub Actions to commit SHAs (rust-lang/cargo#16868) - chore(ci): Update `actions/checkout` from v5 to v6 (rust-lang/cargo#16867) - Add test for cargo install with github fastpath (rust-lang/cargo#16866)
Update cargo submodule 28 commits in eb94155a9a60943bd7b1cb04abec42f5d0de6ddc..7ecf0285ebb408d596e4a8ac76a0980d8edb7005 2026-04-09 13:10:20 +0000 to 2026-04-18 15:34:11 +0000 - fix: use `portable-atomic` for 64-bit atomics (rust-lang/cargo#16906) - fix: rename incorrectly documented target-spec-json to json-target-sp… (rust-lang/cargo#16905) - Add global HTTP timeout tracking to http_async (rust-lang/cargo#16903) - feat(config): Stabilize `resolver.lockfile-path` config (rust-lang/cargo#16694) - chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#16897) - fix: rebuild rustdoc json for different versions of a same crate (rust-lang/cargo#16773) - Add effective_url to http_async (rust-lang/cargo#16899) - Make crate downloads process as a queue rather than a stack (rust-lang/cargo#16898) - fix: sparse registry fetch progress reporting (rust-lang/cargo#16900) - chore: bump to 0.98.0; update changelog (rust-lang/cargo#16892) - docs(semver-check): update diagnostics to Rust 1.95 (rust-lang/cargo#16895) - docs(ref): Better highlight 'package --list' for include/exclude (rust-lang/cargo#16891) - docs: `include` doesnt apply gitignore from repo (rust-lang/cargo#16890) - fix: Update `bash` and `zsh` Autocompletion Documents to add `-m` (rust-lang/cargo#16888) - Add `-m` shorthand for `--manifest-path` (rust-lang/cargo#16858) - Fix a typo (rust-lang/cargo#16885) - Always take a shared lock on `.cargo-lock` (rust-lang/cargo#16886) - fix(toml): Teach users how to pin edition (rust-lang/cargo#16851) - fix: Prefer defined lint levels over default (rust-lang/cargo#16879) - chore(deps): bump rand from 0.10.0 to 0.10.1 (rust-lang/cargo#16883) - fix(lints): Ignore unused_crate_dependencies status (rust-lang/cargo#16877) - Copy cargo clean target-dir validation tests to clean_new_layout.rs (rust-lang/cargo#16878) - cargo clean: Add target directory validation (rust-lang/cargo#16712) - Docs: "api" in the configuration should not include a trailing slash (rust-lang/cargo#16869) - fix(core): use `closest_msg` to suggest similar member name for mistyped `-p` (rust-lang/cargo#16844) - chore(ci): Pin GitHub Actions to commit SHAs (rust-lang/cargo#16868) - chore(ci): Update `actions/checkout` from v5 to v6 (rust-lang/cargo#16867) - Add test for cargo install with github fastpath (rust-lang/cargo#16866)
Update cargo submodule 28 commits in eb94155a9a60943bd7b1cb04abec42f5d0de6ddc..7ecf0285ebb408d596e4a8ac76a0980d8edb7005 2026-04-09 13:10:20 +0000 to 2026-04-18 15:34:11 +0000 - fix: use `portable-atomic` for 64-bit atomics (rust-lang/cargo#16906) - fix: rename incorrectly documented target-spec-json to json-target-sp… (rust-lang/cargo#16905) - Add global HTTP timeout tracking to http_async (rust-lang/cargo#16903) - feat(config): Stabilize `resolver.lockfile-path` config (rust-lang/cargo#16694) - chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#16897) - fix: rebuild rustdoc json for different versions of a same crate (rust-lang/cargo#16773) - Add effective_url to http_async (rust-lang/cargo#16899) - Make crate downloads process as a queue rather than a stack (rust-lang/cargo#16898) - fix: sparse registry fetch progress reporting (rust-lang/cargo#16900) - chore: bump to 0.98.0; update changelog (rust-lang/cargo#16892) - docs(semver-check): update diagnostics to Rust 1.95 (rust-lang/cargo#16895) - docs(ref): Better highlight 'package --list' for include/exclude (rust-lang/cargo#16891) - docs: `include` doesnt apply gitignore from repo (rust-lang/cargo#16890) - fix: Update `bash` and `zsh` Autocompletion Documents to add `-m` (rust-lang/cargo#16888) - Add `-m` shorthand for `--manifest-path` (rust-lang/cargo#16858) - Fix a typo (rust-lang/cargo#16885) - Always take a shared lock on `.cargo-lock` (rust-lang/cargo#16886) - fix(toml): Teach users how to pin edition (rust-lang/cargo#16851) - fix: Prefer defined lint levels over default (rust-lang/cargo#16879) - chore(deps): bump rand from 0.10.0 to 0.10.1 (rust-lang/cargo#16883) - fix(lints): Ignore unused_crate_dependencies status (rust-lang/cargo#16877) - Copy cargo clean target-dir validation tests to clean_new_layout.rs (rust-lang/cargo#16878) - cargo clean: Add target directory validation (rust-lang/cargo#16712) - Docs: "api" in the configuration should not include a trailing slash (rust-lang/cargo#16869) - fix(core): use `closest_msg` to suggest similar member name for mistyped `-p` (rust-lang/cargo#16844) - chore(ci): Pin GitHub Actions to commit SHAs (rust-lang/cargo#16868) - chore(ci): Update `actions/checkout` from v5 to v6 (rust-lang/cargo#16867) - Add test for cargo install with github fastpath (rust-lang/cargo#16866)
After rust-lang/cargo#16712, `cargo clean` requires a CACHEDIR.TAG file to work. As we RmTree() the build dir a bit further up, it doesn't naturally exist for us, so put one there. (https://chromium-review.googlesource.com/c/chromium/src/+/7614540 added the `cargo clean` call -- I suppose `cargo clean` cleans things outside of the build dir? Else this would've been redundant after the RmTree.) Bug: 504672125 Change-Id: I673de8a9f395e69991aea43b5edfc35db4658544 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7782785 Commit-Queue: Nico Weber <thakis@chromium.org> Reviewed-by: Arthur Eubanks <aeubanks@google.com> Cr-Commit-Position: refs/heads/main@{#1618312}
… exist (rust-lang#16934) Fixes rust-lang#16925 Regressed in rust-lang#16712 which added validation for explicitly specified target directories by checking if they contain a valid `CACHEDIR.TAG`. This PR makes it so that cargo skips this validation if the target-dir doesn't exist.
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [rust](https://github.com/rust-lang/rust) | minor | `1.96.1` → `1.97.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>rust-lang/rust (rust)</summary> ### [`v1.97.0`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1970-2026-07-09) [Compare Source](rust-lang/rust@1.96.1...1.97.0) \========================== <a id="1.97.0-Language"></a> ## Language - [Consider `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` to be equivalent to `T` for must use lint](rust-lang/rust#148214) - [Add allow-by-default `dead_code_pub_in_binary` lint for unused pub items in binary crates](rust-lang/rust#149509) - [Stabilize the `div32`, `lam-bh`, `lamcas`, `ld-seq-sa` and `scq` target features](rust-lang/rust#154510) - [Stabilize `cfg(target_has_atomic_primitive_alignment)`](rust-lang/rust#155006) - [Allow trailing `self` in imports in more cases](rust-lang/rust#155137) <a id="1.97.0-Platform-Support"></a> ## Platform Support - [nvptx64-nvidia-cuda: drop support for old architectures and old ISAs](rust-lang/rust#152443) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. [platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html <a id="1.97.0-Stabilized-APIs"></a> ## Stabilized APIs - [`Default for RepeatN`](https://doc.rust-lang.org/stable/std/iter/struct.RepeatN.html#impl-Default-for-RepeatN%3CA%3E) - [`Copy for ffi::FromBytesUntilNulError`](https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html#impl-Copy-for-FromBytesUntilNulError) - [`Send for std::fs::File` on UEFI](rust-lang/rust#154003) - [`<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_highest_one) - [`<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_lowest_one) - [`<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.highest_one) - [`<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.lowest_one) - [`<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.bit_width) - [`NonZero<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_highest_one) - [`NonZero<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_lowest_one) - [`NonZero<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.highest_one) - [`NonZero<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.lowest_one) - [`NonZero<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.bit_width) These previously stable APIs are now stable in const contexts: - [`char::is_control`](https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_control) <a id="1.97.0-Cargo"></a> ## Cargo - [Stabilize `build.warnings` config.](rust-lang/cargo#16796) This controls how lint warnings from local packages are treated. Useful for enforcing a warning-free build in CI, replacing `-Dwarnings`. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#buildwarnings) - [Stabilize `resolver.lockfile-path` config.](rust-lang/cargo#16694) This allows specifying the path to the lockfile to use when resolving dependencies. Useful when working with read-only source directories. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#resolverlockfile-path) - [cargo-clean: Error when `--target-dir` doesn't look like a Cargo target directory.](rust-lang/cargo#16712) This prevents accidental deletion of non-target directories. - [Add `-m` shorthand for `--manifest-path`](rust-lang/cargo#16858) - [Remove `curl` dependency from `crates-io` crate](rust-lang/cargo#16936) <a id="1.97.0-Rustdoc"></a> ## Rustdoc - [Stabilize `--emit` flag](rust-lang/rust#146220) - [Stabilize `--remap-path-prefix`](rust-lang/rust#155307) <a id="1.97.0-Compatibility-Notes"></a> ## Compatibility Notes - [Emit a future-compatibility warning when relying on `f32: From<{float}>` to constrain `{float}`](rust-lang/rust#139087) - [Rust will use the v0 symbol mangling scheme by default.](rust-lang/rust#151994) This may cause some tools (such as debuggers or profilers, especially with old versions) to fail to demangle symbols emitted by Rust. It may also cause the formatting of text in backtraces to change. - [Prevent deref coercions in `pin!`, in order to prevent unsoundness.](rust-lang/rust#153457) The most likely case where this might impact users is: writing `pin!(x)` where `x` has type `&mut T` will now always correctly produce a value of type `Pin<&mut &mut T>`, instead of sometimes allowing a coercion that produces a value of type `Pin<&mut T>`. This coercion was previously incorrectly allowed since Rust 1.88.0. - [Deprecate `std::char` constants and functions](rust-lang/rust#153873) - [Warn on linker output by default](rust-lang/rust#153968) - [Remove hidden `f64` methods which have been deprecated since 1.0](rust-lang/rust#153975) - [report the `varargs_without_pattern` lint in deps](rust-lang/rust#154599) - [Forbid passing generic arguments to module path segments even if the module reexports a generic enum variant](rust-lang/rust#154971) - [Error on invalid macho `link_section` specifier](rust-lang/rust#155065) - The encoding of certain `enum`s [have changed](rust-lang/rust#155473). This is not a breaking change, as it only applies to `enum`s without layout guarantees, but is noted here as we've seen people impacted from having made assumptions about the layout algorithm. - [Error on `#[export_name = "..."]` where the name is empty](rust-lang/rust#155515) - [Syntactically reject tuple index shorthands in struct patterns](rust-lang/rust#155698) - [validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters](rust-lang/rust#155817) - On Windows, after calling `shutdown` on a socket to shut down the write side, attempting to write to the socket will now produce a `BrokenPipe` error rather than `Other`. [Map `WSAESHUTDOWN` to `io::ErrorKind::BrokenPipe`](rust-lang/rust#156063) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [rust](https://github.com/rust-lang/rust) | | minor | `1.96.1` → `1.97.0` | | rust | stage | minor | `1.96-bookworm` → `1.97-bookworm` | --- ### Release Notes <details> <summary>rust-lang/rust (rust)</summary> ### [`v1.97.0`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1970-2026-07-09) [Compare Source](rust-lang/rust@1.96.1...1.97.0) \========================== <a id="1.97.0-Language"></a> ## Language - [Consider `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` to be equivalent to `T` for must use lint](rust-lang/rust#148214) - [Add allow-by-default `dead_code_pub_in_binary` lint for unused pub items in binary crates](rust-lang/rust#149509) - [Stabilize the `div32`, `lam-bh`, `lamcas`, `ld-seq-sa` and `scq` target features](rust-lang/rust#154510) - [Stabilize `cfg(target_has_atomic_primitive_alignment)`](rust-lang/rust#155006) - [Allow trailing `self` in imports in more cases](rust-lang/rust#155137) <a id="1.97.0-Platform-Support"></a> ## Platform Support - [nvptx64-nvidia-cuda: drop support for old architectures and old ISAs](rust-lang/rust#152443) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. [platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html <a id="1.97.0-Stabilized-APIs"></a> ## Stabilized APIs - [`Default for RepeatN`](https://doc.rust-lang.org/stable/std/iter/struct.RepeatN.html#impl-Default-for-RepeatN%3CA%3E) - [`Copy for ffi::FromBytesUntilNulError`](https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html#impl-Copy-for-FromBytesUntilNulError) - [`Send for std::fs::File` on UEFI](rust-lang/rust#154003) - [`<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_highest_one) - [`<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_lowest_one) - [`<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.highest_one) - [`<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.lowest_one) - [`<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.bit_width) - [`NonZero<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_highest_one) - [`NonZero<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_lowest_one) - [`NonZero<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.highest_one) - [`NonZero<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.lowest_one) - [`NonZero<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.bit_width) These previously stable APIs are now stable in const contexts: - [`char::is_control`](https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_control) <a id="1.97.0-Cargo"></a> ## Cargo - [Stabilize `build.warnings` config.](rust-lang/cargo#16796) This controls how lint warnings from local packages are treated. Useful for enforcing a warning-free build in CI, replacing `-Dwarnings`. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#buildwarnings) - [Stabilize `resolver.lockfile-path` config.](rust-lang/cargo#16694) This allows specifying the path to the lockfile to use when resolving dependencies. Useful when working with read-only source directories. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#resolverlockfile-path) - [cargo-clean: Error when `--target-dir` doesn't look like a Cargo target directory.](rust-lang/cargo#16712) This prevents accidental deletion of non-target directories. - [Add `-m` shorthand for `--manifest-path`](rust-lang/cargo#16858) - [Remove `curl` dependency from `crates-io` crate](rust-lang/cargo#16936) <a id="1.97.0-Rustdoc"></a> ## Rustdoc - [Stabilize `--emit` flag](rust-lang/rust#146220) - [Stabilize `--remap-path-prefix`](rust-lang/rust#155307) <a id="1.97.0-Compatibility-Notes"></a> ## Compatibility Notes - [Emit a future-compatibility warning when relying on `f32: From<{float}>` to constrain `{float}`](rust-lang/rust#139087) - [Rust will use the v0 symbol mangling scheme by default.](rust-lang/rust#151994) This may cause some tools (such as debuggers or profilers, especially with old versions) to fail to demangle symbols emitted by Rust. It may also cause the formatting of text in backtraces to change. - [Prevent deref coercions in `pin!`, in order to prevent unsoundness.](rust-lang/rust#153457) The most likely case where this might impact users is: writing `pin!(x)` where `x` has type `&mut T` will now always correctly produce a value of type `Pin<&mut &mut T>`, instead of sometimes allowing a coercion that produces a value of type `Pin<&mut T>`. This coercion was previously incorrectly allowed since Rust 1.88.0. - [Deprecate `std::char` constants and functions](rust-lang/rust#153873) - [Warn on linker output by default](rust-lang/rust#153968) - [Remove hidden `f64` methods which have been deprecated since 1.0](rust-lang/rust#153975) - [report the `varargs_without_pattern` lint in deps](rust-lang/rust#154599) - [Forbid passing generic arguments to module path segments even if the module reexports a generic enum variant](rust-lang/rust#154971) - [Error on invalid macho `link_section` specifier](rust-lang/rust#155065) - The encoding of certain `enum`s [have changed](rust-lang/rust#155473). This is not a breaking change, as it only applies to `enum`s without layout guarantees, but is noted here as we've seen people impacted from having made assumptions about the layout algorithm. - [Error on `#[export_name = "..."]` where the name is empty](rust-lang/rust#155515) - [Syntactically reject tuple index shorthands in struct patterns](rust-lang/rust#155698) - [validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters](rust-lang/rust#155817) - On Windows, after calling `shutdown` on a socket to shut down the write side, attempting to write to the socket will now produce a `BrokenPipe` error rather than `Other`. [Map `WSAESHUTDOWN` to `io::ErrorKind::BrokenPipe`](rust-lang/rust#156063) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), 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. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL21pbm9yIl19--> Reviewed-on: https://codeberg.org/towonel/towonel/pulls/58
View all comments
What does this PR try to resolve?
Fixes #9192
Implements the checks mentioned in this comment
To summarise, when
cargo cleanis run with a specified target directory:--target-dir: check if a validCACHEDIR.TAGexists in the target directory and hard error otherwise.emit a future incompat warning if the target directory does not contain a validNo longer this case. See cargo clean: Add target directory validation #16712 (comment)CACHEDIR.TAGTests
I've added 3 sets of unit tests for:
--target-diris used explicitlyCARGO_TARGET_DIRenv variableLet me know if there is a case I've missed or if i need to merge multiple tests into a single one.