Skip to content

Re-stabilize build-dir layout v2 - #17354

Draft
ranger-ross wants to merge 1 commit into
rust-lang:masterfrom
ranger-ross:restablize-build-dir-new-layout
Draft

Re-stabilize build-dir layout v2#17354
ranger-ross wants to merge 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 from 7cef870 to be983b0 Compare August 12, 2026 17:21
@ranger-ross
ranger-ross force-pushed the restablize-build-dir-new-layout branch 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

rustbot commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #17333) made this pull request unmergeable. Please resolve the merge conflicts.

@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
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 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