Enable build-dir layout v2 on nightly by default#17258
Conversation
3f297a4 to
d34b4b3
Compare
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Marking this as ready to review. I spent some time trying to reproduce sccache failures with argfiles on windows, and couldn't get a failure. (tested on zed again, with |
| /// gating unstable functionality to Cargo. These flags are only available on | ||
| /// the nightly channel of Cargo. | ||
| #[derive(Default, Debug, Deserialize)] | ||
| #[derive(Debug, Deserialize)] |
There was a problem hiding this comment.
Is there a way to do this without removing Default? This makes it more invasive to undo and redo.
There was a problem hiding this comment.
Ehh its get awkward to avoid, specially due to #[serde(default)].
I split out a refactor commit and manually impl'd Default in the macro to reduce the bloat and need to update the Default impl when adding new features.
It's still not ideal but maybe a bit better?
d34b4b3 to
4bb796b
Compare
This comment has been minimized.
This comment has been minimized.
4bb796b to
7b66084
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| // Defaults to enabled on nightly unless explicitly opted out. | ||
| let c = &channel(); | ||
| unstable.build_dir_new_layout = | ||
| (c == "nightly" || c == "dev") && !is_new_build_dir_layout_opt_out(); |
There was a problem hiding this comment.
Josh (or someone I don't remember) has mentioned there are people using stable toolchains but enable RUSTC_BOOTSTRAP=1 for enabling some unstable features. Should we avoid enable it if the toolchain is stable/beta?
There was a problem hiding this comment.
It was @Mark-Simulacrum that mentioned it here.
Yeah, I think that makes sense. When that comment was made it kind of went over my head (we have so many bespoke config options 😆)
If I understand it correctly, enabling RUSTC_BOOTSTRAP=1 will result in Cargo using the dev channel.
cargo/src/workspace/features.rs
Lines 1602 to 1605 in 5b6fca7
So the logic should be updated to
let is_rustc_bootstrap = env::var("RUSTC_BOOTSTRAP").map(|o| &o == "1");
unstable.build_dir_new_layout = (c == "nightly" || c == "dev") && !is_new_build_dir_layout_opt_out() && !is_rustc_bootstrap;Will this cause an issues in bootstrap? I guess not since bootstrap explicitly passes -Zbuild-dir-new-layout and this is just for the defaults.
Does that all sound correct?
There was a problem hiding this comment.
Either that or just something like crate::version().release_channel == Some("nightly" | "dev")?
There was a problem hiding this comment.
ah yeah that should work. I wish I had thought of this before updating all of the tests again. 🫠
Since this skips __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS none of the tests need to be updated
7b66084 to
d035da6
Compare
Cargo enables build-dir layout v2 by default on nightly (rust-lang/cargo#17258). Intermediate build artifacts no longer live in `<target-dir>/<triple>/<profile>/deps/` but in per-unit `build/<pkg>/<hash>/out/` directories. Search the target directory recursively instead of hardcoding the artifact location, so these tests pass under both the old and the new layout.
Cargo enables build-dir layout v2 by default on nightly (rust-lang/cargo#17258). Intermediate build artifacts no longer live in `<target-dir>/<triple>/<profile>/deps/` but in per-unit `build/<pkg>/<hash>/out/` directories.
Update cargo submodule 17 commits in 3efb1f477e99b42974b982d939fd100303cdf7db..54b61f13a4eea47ec3ee95237d4107976d7909ed 2026-07-17 23:53:19 +0000 to 2026-07-24 13:23:18 +0000 - chore: bump to `libgit2-sys@0.18.7+1.9.6` (rust-lang/cargo#17259) - Enable build-dir layout v2 on nightly by default (rust-lang/cargo#17258) - fix(path): clarify error message when path dependency has wrong package (rust-lang/cargo#16927) - fix(toml): warn on hyphenated lint names and duplicates (rust-lang/cargo#17051) - fix(test): gate trim-paths tests on split debuginfo support (rust-lang/cargo#17256) - test(git): Explicitly test for git injection attacks (rust-lang/cargo#17253) - fix(git): Suggest libgit2 if git-cli fails (rust-lang/cargo#17252) - fix(diag): bound transitive unused dependency traversal (rust-lang/cargo#17251) - fix(git): Hide git fetch output without progress (rust-lang/cargo#17243) - revert(lint): Remove `new_implicit_minimum_version_req` (rust-lang/cargo#16321) (rust-lang/cargo#17249) - fix: Add haiku's dylib path (rust-lang/cargo#17248) - Zsh completion: Add `-p` and `--package` flags for `cargo add` (rust-lang/cargo#17247) - refactor(source): Clarify the name of the remote git registry (rust-lang/cargo#17240) - fix(timings): only report units the job queue actually ran (rust-lang/cargo#17238) - Do not include proc-macro deps in rustc search path args (rust-lang/cargo#17236) - chore(deps): update cargo-semver-checks to v0.49.0 (rust-lang/cargo#17237) - rustdoc: rename the doc parts metadata params (rust-lang/cargo#17234) r? ghost
Update cargo submodule 17 commits in 3efb1f477e99b42974b982d939fd100303cdf7db..54b61f13a4eea47ec3ee95237d4107976d7909ed 2026-07-17 23:53:19 +0000 to 2026-07-24 13:23:18 +0000 - chore: bump to `libgit2-sys@0.18.7+1.9.6` (rust-lang/cargo#17259) - Enable build-dir layout v2 on nightly by default (rust-lang/cargo#17258) - fix(path): clarify error message when path dependency has wrong package (rust-lang/cargo#16927) - fix(toml): warn on hyphenated lint names and duplicates (rust-lang/cargo#17051) - fix(test): gate trim-paths tests on split debuginfo support (rust-lang/cargo#17256) - test(git): Explicitly test for git injection attacks (rust-lang/cargo#17253) - fix(git): Suggest libgit2 if git-cli fails (rust-lang/cargo#17252) - fix(diag): bound transitive unused dependency traversal (rust-lang/cargo#17251) - fix(git): Hide git fetch output without progress (rust-lang/cargo#17243) - revert(lint): Remove `new_implicit_minimum_version_req` (rust-lang/cargo#16321) (rust-lang/cargo#17249) - fix: Add haiku's dylib path (rust-lang/cargo#17248) - Zsh completion: Add `-p` and `--package` flags for `cargo add` (rust-lang/cargo#17247) - refactor(source): Clarify the name of the remote git registry (rust-lang/cargo#17240) - fix(timings): only report units the job queue actually ran (rust-lang/cargo#17238) - Do not include proc-macro deps in rustc search path args (rust-lang/cargo#17236) - chore(deps): update cargo-semver-checks to v0.49.0 (rust-lang/cargo#17237) - rustdoc: rename the doc parts metadata params (rust-lang/cargo#17234) r? ghost
What does this PR try to resolve?
This PR enables the new
build-diron nightly by default.The majority of changes were taken/adapted from #16807
Tracked in #15010
How to test and review this PR?
Same as the original stabilization PR.
The notable changes are:
p.cargo()use a mixture of stable and nightlyp.cargo()as the tests are specifically testing for rebuilds.