Skip to content

Add support for Cargo's new build-dir layout#449

Merged
pacak merged 1 commit intopacak:masterfrom
ranger-ross:build-dir-new-layout
Mar 13, 2026
Merged

Add support for Cargo's new build-dir layout#449
pacak merged 1 commit intopacak:masterfrom
ranger-ross:build-dir-new-layout

Conversation

@ranger-ross
Copy link
Copy Markdown
Contributor

@ranger-ross ranger-ross commented Mar 13, 2026

This PR adds logic to handle the new layout of Cargo's build-dir which changes the directory structure of Cargo internally.
(can be enabled with -Zbuild-dir-new-layout)

Resources

This commit adds logic to handle the new layout of Cargo's `build-dir`
which changes the directory structure of Cargo internally.

See rust-lang/cargo#15010
@pacak
Copy link
Copy Markdown
Owner

pacak commented Mar 13, 2026

Is it different from #409 ?

@pacak
Copy link
Copy Markdown
Owner

pacak commented Mar 13, 2026

rust-lang/cargo#13672 - also related.

@ranger-ross
Copy link
Copy Markdown
Contributor Author

Is it different from #409 ?

Yes, in #409 it added support for Cargo's build-dir.
Internally Cargo has split target into 2 directories build-dir (stabilized in Rust 1.91) and artifact-dir (still unstable)
Both of these point to target by default so user's often do not realized they are separate.

There is a separate change to restructure the file layout of build-dir to fix some long standing issues in Cargo and unblock new features. The blog post linked above has a pretty summary of the structural changes.
This PR is adding support for the new file layout (while keeping support for the old layout for backwards compatibility)

@pacak
Copy link
Copy Markdown
Owner

pacak commented Mar 13, 2026

Seems to work. Or at least it doesn't break the existing build :)

If only cargo would pass the info about generated files - whole this guessing whack-a-mole wouldn't be necessary.

Let's merge it, I appreciate the contribution ❤️

@pacak pacak merged commit 15e3e85 into pacak:master Mar 13, 2026
6 checks passed
@ranger-ross
Copy link
Copy Markdown
Contributor Author

Thanks! And for what it's worth, your issue was called out in the known issues of the tracking issue as things we need to improve so people do not need to rely on Cargo internals.

@ranger-ross ranger-ross deleted the build-dir-new-layout branch March 13, 2026 17:45
pacak added a commit that referenced this pull request Mar 13, 2026
- More support for cargo build-dir (#449)
- `-p` suppors both package name and package ids (#450)
@pacak pacak mentioned this pull request Mar 13, 2026
pacak added a commit that referenced this pull request Mar 13, 2026
- More support for cargo build-dir (#449)
- `-p` suppors both package name and package ids (#450)
@pacak
Copy link
Copy Markdown
Owner

pacak commented Mar 13, 2026

0.2.57 is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants