Skip to content

Re-stabilize build-dir layout v2 - #17354

Merged
weihanglo merged 1 commit into
rust-lang:masterfrom
ranger-ross:restablize-build-dir-new-layout
Aug 18, 2026
Merged

Re-stabilize build-dir layout v2#17354
weihanglo merged 1 commit into
rust-lang:masterfrom
ranger-ross:restablize-build-dir-new-layout

Conversation

@ranger-ross

@ranger-ross ranger-ross commented Aug 12, 2026

Copy link
Copy Markdown
Member

What does this PR try to resolve?

This PR restabilizes the new build-dir layout tracked in #15010.

The previous stablization in #16807 was rolled back due to performance and scaling issues discovered on nightly.
These issues were mitigated in #17191, #17168, and #17236.

The new layout was re-enabled on nightly in #17258 and there has been no reported issues. Many tools have started migrating and the majority of well known tools have already added support for the new build-dir layout.

closes #15010

How to test and review this PR?

cargo test and the new layout has been enabled on nightly for ~2 weeks.

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-testing-cargo-itself Area: cargo's tests A-unstable Area: nightly unstable support labels Aug 12, 2026
@ranger-ross
ranger-ross force-pushed the restablize-build-dir-new-layout branch 2 times, most recently from be983b0 to cb74501 Compare August 12, 2026 18:02

@ranger-ross ranger-ross Aug 12, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all tests should be passing now except profile_trim_paths::unremap_file_with_cargo_clean.

I believe the target/debug/foo.trim-paths.jsonl file was previously getting removed with cargo clean -p foo -Ztrim-paths, but is not getting removed when the new build-dir layout is enabled.

So its hitting this assert:

assert!(!unremap_file_path(&p.bin("foo")).exists());

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the intended behavior here? Does cargo clean -p foo remove target/debug/foo on both old and new build layout?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, wasn't fully sure. So I left it failing for now.

If the trim paths artifacts is generated for crate foo and you clean the foo crate it seems reasonable to me to expect that file to be removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would expect that. The foo.trim-paths.jsonl is a companion file for the root binary unit, similar to pdb on Windows, dSYM on macOS, and dwp/dwo file on Linux.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posted #17356 for this :D

@epage epage Aug 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocked until at least August 14th to be after beta branch: https://forge.rust-lang.org/

View changes since the review

@epage

epage commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Is there anything different in this stabilization PR compared to the previous one?

@ranger-ross

Copy link
Copy Markdown
Member Author

Is there anything different in this stabilization PR compared to the previous one?

It should be largely the same with the following differences:

  1. We no longer have the ugly impl Default for CliUnstable
  2. There were new tests that were recently added that needed to be updated
  3. Due to 80f7382 there were more -L dependency= args removed than the previous PR.

@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Aug 13, 2026
pull Bot pushed a commit to pepe57/cargo that referenced this pull request Aug 13, 2026
…ut (rust-lang#17356)

### What does this PR try to resolve?

See rust-lang#17354 (comment)
for the motivating context.

In rust-lang#17303 we started emitting
unremap files to final artifacts.
This included logic for cleaning the unremap file when running `cargo
clean -p` but the logic was not added in the `.build_dir_new_layout`
branch in the cargo clean logic.

This PR adds the logic to both branches.

### How to test and review this PR?

Primarily using the existing tests

r? @weihanglo
@ranger-ross
ranger-ross force-pushed the restablize-build-dir-new-layout branch 4 times, most recently from 59957dc to ede4285 Compare August 14, 2026 09:13
@ranger-ross
ranger-ross force-pushed the restablize-build-dir-new-layout branch from ede4285 to efb0721 Compare August 14, 2026 13:01
@weihanglo

Copy link
Copy Markdown
Member

FYI, branch promotion is done.

@ranger-ross
ranger-ross marked this pull request as ready for review August 18, 2026 00:15
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @epage, @weihanglo
  • @epage, @weihanglo expanded to epage, weihanglo
  • Random selection from epage, weihanglo

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have FCP already in #16807 (comment). I don't think we need a new one.

View changes since this review


Caused by:
process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build1` ([EXIT_STATUS]: 101)
process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo/[HASH]/out/build_script_build1` ([EXIT_STATUS]: 101)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot why this executable name changed. Could you remind me?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #16812

The TL;DR is that the build_script_build.exe always existed, but we would "uplift" it to the same directory with the kebab cased name + -Cextra-filename. Since the hash is in the directory path, -Cextra-filename is not needed. So we were just renaming the script from snake to kebab case, which felt unnecessary so we removed that step to keep it simple.

@weihanglo
weihanglo added this pull request to the merge queue Aug 18, 2026
Merged via the queue into rust-lang:master with commit 36e1162 Aug 18, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2026
@weihanglo weihanglo added the relnotes Release-note worthy label Aug 18, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Aug 18, 2026
Update cargo submodule

3 commits in 8a0d8afba810304bcf9a10bac430be80dd470233..36e1162a7989dd1d11b75bfa90283efcbf162cac
2026-08-15 01:32:53 +0000 to 2026-08-18 02:35:44 +0000
- Re-stabilize build-dir layout v2 (rust-lang/cargo#17354)
- Enable `-Zembed-metadata=no` by default on nightly Cargo (rust-lang/cargo#17267)
- fix(frontmatter): Don't panic on a short closing fence before a non-ASCII char (rust-lang/cargo#17274)

r? ghost
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Aug 19, 2026
Update cargo submodule



6 commits in 8a0d8afba810304bcf9a10bac430be80dd470233..514c56dd7321eecbfdcf9b6479519cf4edfab906
2026-08-15 01:32:53 +0000 to 2026-08-19 00:31:04 +0000
- fix(git): `git gc` with `safe.bareRepository=explicit` (rust-lang/cargo#17370)
- test: make snapshots agnostic to `-Zembed-metadata=no` (rust-lang/cargo#17374)
- fix(clean): Improving description for clean options (rust-lang/cargo#17365)
- Re-stabilize build-dir layout v2 (rust-lang/cargo#17354)
- Enable `-Zembed-metadata=no` by default on nightly Cargo (rust-lang/cargo#17267)
- fix(frontmatter): Don't panic on a short closing fence before a non-ASCII char (rust-lang/cargo#17274)
@rustbot rustbot added this to the 1.100.0 milestone Aug 19, 2026
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Aug 19, 2026
Update cargo submodule



6 commits in 8a0d8afba810304bcf9a10bac430be80dd470233..514c56dd7321eecbfdcf9b6479519cf4edfab906
2026-08-15 01:32:53 +0000 to 2026-08-19 00:31:04 +0000
- fix(git): `git gc` with `safe.bareRepository=explicit` (rust-lang/cargo#17370)
- test: make snapshots agnostic to `-Zembed-metadata=no` (rust-lang/cargo#17374)
- fix(clean): Improving description for clean options (rust-lang/cargo#17365)
- Re-stabilize build-dir layout v2 (rust-lang/cargo#17354)
- Enable `-Zembed-metadata=no` by default on nightly Cargo (rust-lang/cargo#17267)
- fix(frontmatter): Don't panic on a short closing fence before a non-ASCII char (rust-lang/cargo#17274)
pull Bot pushed a commit to asukaminato0721/rust-analyzer that referenced this pull request Aug 20, 2026
Update cargo submodule



6 commits in 8a0d8afba810304bcf9a10bac430be80dd470233..514c56dd7321eecbfdcf9b6479519cf4edfab906
2026-08-15 01:32:53 +0000 to 2026-08-19 00:31:04 +0000
- fix(git): `git gc` with `safe.bareRepository=explicit` (rust-lang/cargo#17370)
- test: make snapshots agnostic to `-Zembed-metadata=no` (rust-lang/cargo#17374)
- fix(clean): Improving description for clean options (rust-lang/cargo#17365)
- Re-stabilize build-dir layout v2 (rust-lang/cargo#17354)
- Enable `-Zembed-metadata=no` by default on nightly Cargo (rust-lang/cargo#17267)
- fix(frontmatter): Don't panic on a short closing fence before a non-ASCII char (rust-lang/cargo#17274)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-documenting-cargo-itself Area: Cargo's documentation A-testing-cargo-itself Area: cargo's tests A-unstable Area: nightly unstable support relnotes Release-note worthy S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-organize build-dir by package + hash, rather than artifact type

4 participants