Skip to content

test: Don't make assumptions about the build-dir layout#6737

Merged
ytmimi merged 1 commit into
rust-lang:mainfrom
epage:tests
Dec 3, 2025
Merged

test: Don't make assumptions about the build-dir layout#6737
ytmimi merged 1 commit into
rust-lang:mainfrom
epage:tests

Conversation

@epage
Copy link
Copy Markdown
Contributor

@epage epage commented Dec 2, 2025

Cargo is experimenting with a new build-dir layout which will break the assumptions that rustfmt makes on cargo's internals.

See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-dir-new-layout

Comment thread tests/rustfmt/main.rs
bin_dir.pop();
}
let cmd = bin_dir.join(format!("rustfmt{}", env::consts::EXE_SUFFIX));
let cmd = env!("CARGO_BIN_EXE_rustfmt");
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.

Who sets CARGO_BIN_EXE_rustfmt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cargo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

How long has cargo set CARGO_BIN_EXE_rustfmt? Would we need to updated the docs to let users know that they'll need a minimum cargo version in order to run the test suite?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That has been there before 1.60. No idea on when (I did backfill some MSRVs in the docs but didn't go back far enough for this).

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.

Ah that's fine, I just wasn't aware of CARGO_BIN_EXE_rustfmt and thought maybe it was something newer that we needed to make sure people knew about, but if it's been around for a while and we can rely on cargo to set it when running cargo test then I think we should be good to go

@ytmimi ytmimi merged commit 3b3758c into rust-lang:main Dec 3, 2025
26 checks passed
@epage epage deleted the tests branch December 4, 2025 13:11
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.

3 participants