fix(publish): Move .crate out of final artifact location#15915
Merged
weihanglo merged 1 commit intorust-lang:masterfrom Dec 4, 2025
Merged
fix(publish): Move .crate out of final artifact location#15915weihanglo merged 1 commit intorust-lang:masterfrom
.crate out of final artifact location#15915weihanglo merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
epage
commented
Sep 3, 2025
weihanglo
reviewed
Sep 26, 2025
This comment has been minimized.
This comment has been minimized.
d742813 to
8cc523d
Compare
8cc523d to
f932701
Compare
This comment has been minimized.
This comment has been minimized.
When `target_dir == build_dir`, ensure `cargo publish` doesn't put intermediate artifacts in the final artifact location of `cargo package`. If anyone was relying on this behavior of `cargo publish`, it will break them. We could avoid this and instead consider the location change to be part of the opt-in of using `build-dir` (until we make it opt-out). Note that we expect to be able to change the layouf of content written to `build-dir` even if users aren't opting in. On the other hand, this will help identify people relying on intermediate artifacts. While there aren't any performance benefits to this, it consolidates all of the uplifting logic and avoids dealing with overlapping `target_dir` and `build_dir`. We could optimize this further by doing a `rename` and only doing a copy if that fails.
86f048c to
86f6344
Compare
86f6344 to
dd06704
Compare
weihanglo
approved these changes
Dec 4, 2025
Member
Contributor
Author
There was a problem hiding this comment.
2 releases would be 1.93 but there is no rush on this
bors
added a commit
to rust-lang/rust
that referenced
this pull request
Dec 5, 2025
Update cargo submodule 9 commits in bd979347d814dfe03bba124165dbce9554d0b4d8..2c283a9a5c5968eeb9a8f12313f04feb1ff8dfac 2025-12-02 16:03:50 +0000 to 2025-12-04 16:47:28 +0000 - fix(publish): Move `.crate` out of final artifact location (rust-lang/cargo#15915) - Remove legacy tmpdir support (rust-lang/cargo#16342) - Run clippy CI on more targets (rust-lang/cargo#16340) - feat: support for rustdoc mergeable cross-crate info (rust-lang/cargo#16309) - fix(timings): unlocked -> unblocked (rust-lang/cargo#16337) - fix(layout): Put examples in their unit dir in new layout (rust-lang/cargo#16335) - fix(frontmatter): Restrict code fence length (rust-lang/cargo#16334) - Update resolver.md: fix compile errors in pseudocode (rust-lang/cargo#16333) - fix(fingerprint): clean doc dirs for only requested targets (rust-lang/cargo#16331) This is best being merged before beta cutoff because rust-lang/cargo#16337 is a nightly regression.
github-actions Bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Dec 5, 2025
Update cargo submodule 9 commits in bd979347d814dfe03bba124165dbce9554d0b4d8..2c283a9a5c5968eeb9a8f12313f04feb1ff8dfac 2025-12-02 16:03:50 +0000 to 2025-12-04 16:47:28 +0000 - fix(publish): Move `.crate` out of final artifact location (rust-lang/cargo#15915) - Remove legacy tmpdir support (rust-lang/cargo#16342) - Run clippy CI on more targets (rust-lang/cargo#16340) - feat: support for rustdoc mergeable cross-crate info (rust-lang/cargo#16309) - fix(timings): unlocked -> unblocked (rust-lang/cargo#16337) - fix(layout): Put examples in their unit dir in new layout (rust-lang/cargo#16335) - fix(frontmatter): Restrict code fence length (rust-lang/cargo#16334) - Update resolver.md: fix compile errors in pseudocode (rust-lang/cargo#16333) - fix(fingerprint): clean doc dirs for only requested targets (rust-lang/cargo#16331) This is best being merged before beta cutoff because rust-lang/cargo#16337 is a nightly regression.
Kobzol
pushed a commit
to Kobzol/rustc_codegen_gcc
that referenced
this pull request
Dec 21, 2025
Update cargo submodule 9 commits in bd979347d814dfe03bba124165dbce9554d0b4d8..2c283a9a5c5968eeb9a8f12313f04feb1ff8dfac 2025-12-02 16:03:50 +0000 to 2025-12-04 16:47:28 +0000 - fix(publish): Move `.crate` out of final artifact location (rust-lang/cargo#15915) - Remove legacy tmpdir support (rust-lang/cargo#16342) - Run clippy CI on more targets (rust-lang/cargo#16340) - feat: support for rustdoc mergeable cross-crate info (rust-lang/cargo#16309) - fix(timings): unlocked -> unblocked (rust-lang/cargo#16337) - fix(layout): Put examples in their unit dir in new layout (rust-lang/cargo#16335) - fix(frontmatter): Restrict code fence length (rust-lang/cargo#16334) - Update resolver.md: fix compile errors in pseudocode (rust-lang/cargo#16333) - fix(fingerprint): clean doc dirs for only requested targets (rust-lang/cargo#16331) This is best being merged before beta cutoff because rust-lang/cargo#16337 is a nightly regression.
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.
When
target_dir == build_dir, ensurecargo publishdoesn't put intermediate artifacts in the final artifact location ofcargo package.What does this PR try to resolve?
In #15910, users could identify that
.cratefiles fromcargo publishare not final artifacts by setting a custombuild-dir. This extends that to all users, ie whenbuild-dir = target-dir(the default currently), making it clear that these files are internal.This also cleans things up by consolidating all of the uplifting logic and avoids dealing with overlapping
target_dirandbuild_dir.How to test and review this PR?
Notes
We could optimize this further by doing a
renameand only doing a copy if that fails, effectively arename_or_copyas opposed to ourhardlink_or_copywe normally use for uplifting. The difference is that we don't do change tracking for.cratefiles but fully re-generate, so we don't benefit from keeping the.cratearound in the original location.