Never include use extra-filename in build scripts#16855
Merged
weihanglo merged 2 commits intorust-lang:masterfrom Apr 8, 2026
Merged
Never include use extra-filename in build scripts#16855weihanglo merged 2 commits intorust-lang:masterfrom
weihanglo merged 2 commits intorust-lang:masterfrom
Conversation
RalfJung
reviewed
Apr 8, 2026
| } | ||
|
|
||
| if unit.target.is_custom_build() { | ||
| // Build scripts never never use metadata |
Member
There was a problem hiding this comment.
Suggested change
| // Build scripts never never use metadata | |
| // Build scripts never use metadata |
Member
Author
There was a problem hiding this comment.
thanks, typos can only save me from so much 😆
RalfJung
reviewed
Apr 8, 2026
tests/testsuite/build_dir.rs
Outdated
| "#]]); | ||
| } | ||
|
|
||
| /// __CARGO_DEFAULT_LIB_METADATA is internal but used by rustc bootstrap and https://github.com/RalfJung/rustc-build-sysroot/ |
Member
There was a problem hiding this comment.
Suggested change
| /// __CARGO_DEFAULT_LIB_METADATA is internal but used by rustc bootstrap and https://github.com/RalfJung/rustc-build-sysroot/ | |
| /// __CARGO_DEFAULT_LIB_METADATA is internal but used by rustc bootstrap and Miri. |
Member
|
besides suggestions from Ralf, looks good |
weihanglo
approved these changes
Apr 8, 2026
2a4d0fd to
3cc34d6
Compare
weihanglo
approved these changes
Apr 8, 2026
rust-bors bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Apr 8, 2026
Cargo submodule update 11 commits in a357df4c26fc14514e66aae2a269456b5545c7db..101549dddbd2b08e806f50154e3aa4cb3374cc21 2026-04-03 16:47:15 +0000 to 2026-04-08 12:51:20 +0000 - Never include use extra-filename in build scripts (rust-lang/cargo#16855) - fix(toml): Force script edition warnings on quiet (rust-lang/cargo#16848) - GitHub fast path uses `http_async` (rust-lang/cargo#16847) - feat(manifest): allow git dependency alongside alternate registry (rust-lang/cargo#16810) - fix(auth): add auth scheme hint to token rejected error for alt registries (rust-lang/cargo#16794) - Warn on invalid jobserver file descriptors (rust-lang/cargo#16843) - docs(unstable): List the minimum required MSRV for 'public' field (rust-lang/cargo#16841) - feat(lints): Emit unused_dependencies lint (rust-lang/cargo#16600) - fix(tree): clarify error message when `-i` is used without a package name (rust-lang/cargo#16818) - fix: Typo in target.<cfg>.linker (rust-lang/cargo#16839) - Send Content-Type header with cargo publish requests (rust-lang/cargo#16832) r? ghost
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.
What does this PR try to resolve?
See: #16854
This is that in #16812 we stopped adding the metadata hash to build script names and just call them
build_script_build[EXE]since they are already contained within a directory with the hash.However, I didn't take into consideration
__CARGO_DEFAULT_LIB_METADATA, so if it is passed with a build script in the build graph it will get the wrong path (build_script_build-[HASH][EXE]) when it tries to execute and fail.Looking at the comments about
__CARGO_DEFAULT_LIB_METADATAI get the impression there is no usecase for using it with a build script.So I modified the logic to never include the meta in the build script file names even when
__CARGO_DEFAULT_LIB_METADATA.Let me know if this is a bad assumption.
closes #16854
How to test and review this PR?
See the included test.
Also double checked on https://github.com/RalfJung/rustc-build-sysroot/ and this change fixes the issue for me
cc: @RalfJung
r? @epage