Skip to content

Use the in-tree compiler-builtins for the sysroot #141993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Jun 4, 2025

Many of std's dependency have a dependency on the crates.io compiler-builtins when used with the feature rustc-std-workspace-core. Use a Cargo patch to select the in-tree version instead.

compiler-builtins is also added as a dependency of rustc-std-workspace-core so these crates can remove their crates.io dependency in the future.

Zulip discussion: #t-compiler > Using in-tree compiler-builtins

Once this merges, the following PRs will need to make it to a release for the relevant crates:

The above should cover all tier 1 targets. The remaining cover the rest:

try-job: dist-x86_64-linux
try-job: x86_64-gnu
try-job: x86_64-gnu-aux
try-job: test-various

@rustbot rustbot added A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 4, 2025
@rust-log-analyzer

This comment has been minimized.

@tgross35 tgross35 added the rla-silenced Silences rust-log-analyzer postings to the PR it's added on. label Jun 4, 2025
@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 4, 2025
@tgross35

This comment was marked as outdated.

@rust-bors

This comment was marked as outdated.

rust-bors bot added a commit that referenced this pull request Jun 4, 2025
WIP: Use the in-tree compiler-builtins for the sysroot

Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336)

try-job: x86_64-gnu
try-job: test-various
@tgross35 tgross35 force-pushed the use-in-tree-builtins branch 2 times, most recently from 94592d3 to 3c91330 Compare June 4, 2025 21:01
@tgross35

This comment was marked as outdated.

@rust-bors

This comment was marked as outdated.

@tgross35

This comment was marked as off-topic.

@rust-bors

This comment was marked as off-topic.

@tgross35 tgross35 force-pushed the use-in-tree-builtins branch 2 times, most recently from e3edcc4 to 145c702 Compare June 4, 2025 22:28
@tgross35

This comment was marked as outdated.

@rust-bors

This comment was marked as outdated.

rust-bors bot added a commit that referenced this pull request Jun 4, 2025
WIP: Use the in-tree compiler-builtins for the sysroot

Many of `std`'s dependency have a dependency on the crates.io `compiler-builtins` when used with the feature `rustc-std-workspace-core`. Use a Cargo patch to select the in-tree version instead.

`compiler-builtins` is also added as a dependency of `rustc-std-workspace-core` so these crates can remove their crates.io dependency in the future.

Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336)

try-job: x86_64-gnu
try-job: x86_64-gnu-aux
try-job: test-various
@tgross35

This comment was marked as outdated.

@tgross35 tgross35 force-pushed the use-in-tree-builtins branch from 145c702 to a543f01 Compare June 4, 2025 22:28
@rust-bors

This comment was marked as outdated.

@tgross35 tgross35 changed the title WIP: Use the in-tree compiler-builtins for the sysroot Use the in-tree compiler-builtins for the sysroot Jun 4, 2025
@tgross35 tgross35 marked this pull request as ready for review June 4, 2025 22:30
@tgross35
Copy link
Contributor Author

tgross35 commented Jun 4, 2025

I believe this works now. The first two commits are cherry picks that I will drop once #142036 merges.

r? @bjorn3

@RalfJung
Copy link
Member

RalfJung commented Jun 5, 2025

Sounds like we need a rustc-std-workspace-compiler-builtins that published crates can depend on so that we can control what that dependency actually becomes?

@tgross35
Copy link
Contributor Author

tgross35 commented Jun 5, 2025

That was an alternative - but then updates to the patch section are definitely needed :) By instead making it a dependency of rustc-std-workspace-core at least crates that use it get to clean up a dependency rather than replacing it, and presumably something like xargo would automatically go back to working after the new patch section is no longer needed.

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Jun 5, 2025

⌛ Trying commit 9e8f95d with merge 3cdbe13

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 5, 2025
Use the in-tree `compiler-builtins` for the sysroot

Many of `std`'s dependency have a dependency on the crates.io `compiler-builtins` when used with the feature `rustc-std-workspace-core`. Use a Cargo patch to select the in-tree version instead.

`compiler-builtins` is also added as a dependency of `rustc-std-workspace-core` so these crates can remove their crates.io dependency in the future.

Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336)

try-job: dist-x86_64-linux
try-job: x86_64-gnu
try-job: x86_64-gnu-aux
try-job: test-various
@tgross35
Copy link
Contributor Author

tgross35 commented Jun 5, 2025

@rust-lang/cargo @rust-lang/rust-analyzer does anyone have a rough idea of what changes, if any, would be needed with this PR to keep from breaking -Zbuild-std and R-A's building of the sysroot? The relevant part is that a new (hopefully short lived) patch item in library/Cargo.toml would be required.

@rust-bors
Copy link

rust-bors bot commented Jun 5, 2025

☀️ Try build successful (CI)
Build commit: 3cdbe13 (3cdbe133cdc842e0bd76f5677a578ecc2464b2a8)

tgross35 added 2 commits June 5, 2025 19:53
Many of `std`'s dependency have a dependency on the crates.io
`compiler-builtins` when used with the feature
`rustc-std-workspace-core`. Use a Cargo patch to select the in-tree
version instead.

`compiler-builtins` is also added as a dependency of
`rustc-std-workspace-core` so these crates can remove their crates.io
dependency in the future.
@tgross35 tgross35 force-pushed the use-in-tree-builtins branch from 9e8f95d to 6d859bf Compare June 5, 2025 19:56
tgross35 added a commit to tgross35/rust-stdarch that referenced this pull request Jun 5, 2025
Since [1], this will come automatically from `rustc-std-workspace-core`
and the crates.io dependency should no longer be specified.

[1]: rust-lang/rust#141993
tgross35 added a commit to tgross35/rustc-demangle that referenced this pull request Jun 5, 2025
Since [1], this will come automatically from `rustc-std-workspace-core`
and the crates.io dependency should no longer be specified.

[1]: rust-lang/rust#141993
tgross35 added a commit to tgross35/cfg-if that referenced this pull request Jun 5, 2025
Since [1], this will come automatically from `rustc-std-workspace-core`
and the crates.io dependency should no longer be specified.

[1]: rust-lang/rust#141993
tgross35 added a commit to tgross35/unicode-width that referenced this pull request Jun 5, 2025
Since [1], this will come automatically from `rustc-std-workspace-core`
and the crates.io dependency should no longer be specified.

[1]: rust-lang/rust#141993
tgross35 added a commit to tgross35/dlmalloc-rs that referenced this pull request Jun 5, 2025
Since [1], this will come automatically from `rustc-std-workspace-core`
and the crates.io dependency should no longer be specified.

[1]: rust-lang/rust#141993
tgross35 added a commit to tgross35/rustc-build-sysroot that referenced this pull request Jun 5, 2025
In order to help support changes to the standard library's Cargo
workspace ([1], apply a patch for `crates-io.compiler-builtins` if the
workspace `Cargo.toml` also has one.

[1]: rust-lang/rust#141993
tgross35 added a commit to tgross35/rustc-build-sysroot that referenced this pull request Jun 5, 2025
In order to help support changes to the standard library's Cargo
workspace ([1], apply a patch for `crates-io.compiler-builtins` if the
workspace `Cargo.toml` also has one.

[1]: rust-lang/rust#141993
@rustbot
Copy link
Collaborator

rustbot commented Jun 5, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

tgross35 added a commit to tgross35/rustc-build-sysroot that referenced this pull request Jun 5, 2025
In order to help support changes to the standard library's Cargo
workspace ([1], apply a patch for `crates-io.compiler-builtins` if the
workspace `Cargo.toml` also has one.

[1]: rust-lang/rust#141993
@tgross35
Copy link
Contributor Author

tgross35 commented Jun 5, 2025

Test with RalfJung/rustc-build-sysroot#27

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Jun 5, 2025

⌛ Trying commit 6609ade with merge c106135

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 5, 2025
Use the in-tree `compiler-builtins` for the sysroot

Many of `std`'s dependency have a dependency on the crates.io `compiler-builtins` when used with the feature `rustc-std-workspace-core`. Use a Cargo patch to select the in-tree version instead.

`compiler-builtins` is also added as a dependency of `rustc-std-workspace-core` so these crates can remove their crates.io dependency in the future.

Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336)

Once this merges, the following PRs will need to make it to a release for the relevant crates:

- rust-lang/getopts#119 (can merge at any time)
- rust-lang/hashbrown#625 (can merge at any time)
- rust-lang/stdarch#1825
- rust-lang/rustc-demangle#80
- rust-lang/cfg-if#84
- unicode-rs/unicode-width#77

The above should cover all tier 1 targets. The remaining cover the rest:

- `dlmalloc` (wasm, xous, sgx) alexcrichton/dlmalloc-rs#50
- `gimli` (xous)
- `r-efi`, `r-efi-alloc` (efi)
- `fortanix-sgx-abi` (sgx)
- `hermit-abi` (hermit)
- `wasi` (wasi)

try-job: dist-x86_64-linux
try-job: x86_64-gnu
try-job: x86_64-gnu-aux
try-job: test-various
@tgross35
Copy link
Contributor Author

tgross35 commented Jun 5, 2025

@rust-lang/cargo @rust-lang/rust-analyzer does anyone have a rough idea of what changes, if any, would be needed with this PR to keep from breaking -Zbuild-std and R-A's building of the sysroot? The relevant part is that a new (hopefully short lived) patch item in library/Cargo.toml would be required.

@ehuss was able to verify this didn't seem to break Cargo things: https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/Testing.20with.20a.20specific.20rust-lang.2Frust.20PR/with/522678293

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) A-run-make Area: port run-make Makefiles to rmake.rs A-tidy Area: The tidy tool rla-silenced Silences rust-log-analyzer postings to the PR it's added on. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants