Skip to content
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

Make profiler_builtins an optional dependency of sysroot, not std #131816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zalathar
Copy link
Contributor

This avoids unnecessary rebuilds of std (and the compiler) when build.profiler is toggled off or on.

Fixes #131812.


Background: The profiler_builtins crate has been an optional dependency of std (behind a cargo feature) ever since it was added back in #42433. But as far as I can tell that has only ever been a convenient way to force the crate to be built, not a genuine dependency.

The side-effect of this false dependency is that toggling build.profiler causes a rebuild of std and the compiler, which shouldn't be necessary. This PR therefore makes profiler_builtins an optional dependency of the dummy sysroot crate (#108865), rather than a dependency of std.

What makes this change so small is that all of the necessary infrastructure already exists. Previously, bootstrap would enable the profiler feature on the sysroot crate, which would forward that feature to std. Now, enabling that feature directly enables sysroot's profiler_builtins dependency instead.


I believe this is more of a bootstrap change than a libs change, so tentatively:
r? bootstrap

@Zalathar Zalathar added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Oct 17, 2024
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 17, 2024
@rustbot

This comment was marked as resolved.

@Zalathar
Copy link
Contributor Author

I have tested this locally and it all seems to work as expected. But this change is subtle enough that I don't expect a rubber-stamp.

@Kobzol
Copy link
Contributor

Kobzol commented Oct 17, 2024

It definitely seems subtle, but as often with bootstrap, I'm not sure if we have a better way to test this than to rubber stamp it and send it out to the wild :)

Let's see if PGO works properly on the compiler, as a smoke test.

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 17, 2024
Make `profiler_builtins` an optional dependency of sysroot, not std

This avoids unnecessary rebuilds of std (and the compiler) when `build.profiler` is toggled off or on.

Fixes rust-lang#131812.

---

Background: The `profiler_builtins` crate has been an optional dependency of std (behind a cargo feature) ever since it was added back in rust-lang#42433. But as far as I can tell that has only ever been a convenient way to force the crate to be built, not a genuine dependency.

The side-effect of this false dependency is that toggling `build.profiler` causes a rebuild of std and the compiler, which shouldn't be necessary. This PR therefore makes `profiler_builtins` an optional dependency of the dummy sysroot crate (rust-lang#108865), rather than a dependency of std.

What makes this change so small is that all of the necessary infrastructure already exists. Previously, bootstrap would enable the `profiler` feature on the sysroot crate, which would forward that feature to std. Now, enabling that feature directly enables sysroot's `profiler_builtins` dependency instead.

---

I believe this is more of a bootstrap change than a libs change, so tentatively:
r? bootstrap
@bors
Copy link
Contributor

bors commented Oct 17, 2024

⌛ Trying commit ca6b5d1 with merge e9f26d2...

library/sysroot/Cargo.toml Outdated Show resolved Hide resolved
This avoids unnecessary rebuilds of std (and the compiler) when
`build.profiler` is toggled off or on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing build.profiler forces an unnecessary rebuild of std
5 participants