Enable Cargo's new build-dir layout in tests+ci#6879
Merged
ytmimi merged 2 commits intorust-lang:mainfrom Apr 29, 2026
Merged
Conversation
ytmimi
reviewed
Apr 29, 2026
| if me.ends_with("deps") { | ||
| // Chop off `deps`. | ||
| me.pop(); | ||
| } else { |
Contributor
There was a problem hiding this comment.
Let's keep things consistent with cargo_fmt. Ideally we'd have a single helper function that we could reuse for both so that we didn't have to duplicate this logic.
Suggested change
| } else { | |
| } else if bin_dir.ends_with("out") { |
Member
Author
There was a problem hiding this comment.
Sure good catch. Added!
I didn't see an easy way to share a helper function here, so I kept it as duplicated :/
Lmk if you think there is a nice way to do that or if we should keep it duplicated.
@rustbot ready
ytmimi
reviewed
Apr 29, 2026
| @@ -12,6 +12,11 @@ fn cargo_fmt(args: &[&str]) -> (String, String) { | |||
| bin_dir.pop(); // chop off test exe name | |||
| if bin_dir.ends_with("deps") { | |||
Contributor
There was a problem hiding this comment.
Would be great to add the same comment here about the v1 and v2 build dirs:
// Handle Cargo's old and new filesystem layouts
// * v1: `target/<profile>/deps/test-bin-[HASH][EXE]`
// * v2: `target/<profile>/build/<pkgname>/[HASH]/out/test-bin-[HASH][EXE]`
Contributor
|
@rustbot author |
f5d8a90 to
2ae5398
Compare
ytmimi
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of rust-lang/rust#155439 which enables Cargo's new build-dir layout in tests and CI.
Background
Cargo is planning to stabilize a rework to the build-dir file layout tracked in rust-lang/cargo#15010. (Stabilization PR is currently in FPC rust-lang/cargo#16807)
Our last remaining blocker to merging is preparing
rust-lang/rustto work with the new layout so the Cargo submodule can be merged after stabilization.The
build-dirs file system layout is considered an implementation detail of Cargo is subject to changes. Note that this is different thanartifact-dirwhich is stable. (Together these are usually referred to as thetarget-dir)Changes
This PR has 2 commits:
CARGO_UNSTABLE_BUILD_DIR_NEW_LAYOUTcc: @ytmimi