-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Changing build.profiler
forces an unnecessary rebuild of std
#131812
Comments
I think bootstrap itself is behaving correctly here, in that if the profiler runtime really were a dependency of std, then enabling it should trigger a std rebuild. So it's more of a questionable configuration, in that it really shouldn't be a dependency. Also, toggling the profiler off/on is presumably not very common, especially now that the profiler can be built without the |
Additional note: "profiler" feature can still be enabled on Line 770 in 798fb83
build.profiler logic.
|
I looked into this briefly, and the fix turns out to have been simpler than I was expecting (fingers crossed), so I've filed #131816. |
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
In theory, opening config.toml and toggling
build.profiler
between false and true should be cheap. Setting it to true should cause the profiler runtime to be built, without rebuilding std. And setting it to false should simply cause the rest of the build to pretend that any previously-built compiler runtime doesn't exist.In practice, toggling
build.profiler
does trigger a rebuild of std, which also naturally triggers a rebuild of the compiler.I think this is an artifact of
library/profiler_runtime
being considered an optional dependency of std. And I think that is just an artifact of how the profiler runtime was originally added (#42433), not something that inherently has to be true.Of course, the tricky part will be fixing this without accidentally breaking anything.
The text was updated successfully, but these errors were encountered: