-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add rustc wrapper shim to fix RUSTFLAGS conflicts #20380
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
Conversation
09b75e0
to
603b2b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems worth a try, but note that some formulae builds also set RUSTC_WRAPPER
, and it's not clear how those will interact with this.
As mentioned below, probably also worth actually testing on a Rust build first before merging.
@carlocab How would you suggest we solve this without using
My reading of #18556 is that this would just result in that issue not being fixed because then the formula would be overriding It sounds instead like we should actively discourage ever setting |
We could try We may not even need to solve this, as I did say I don't know how the interaction would happen (and it could happen entirely favourably).
Yes, point taken. Formulae will have to work with ENV.rustflags instead? With methods like ENV.rustflags << "..." for appending, etc. |
b1e58ee
to
91f970c
Compare
Thanks for review @carlocab. Adjusted based on your comments and added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
91f970c
to
5a5392f
Compare
Fixes #18556 by using RUSTC_WRAPPER instead of setting RUSTFLAGS directly. This allows Homebrew's optimization flags to coexist with .cargo/config.toml settings, preventing build failures when projects have their own Rust configuration. - Add rustc_wrapper shim that clears RUSTFLAGS and prepends HOMEBREW_RUSTFLAGS - Update both std and super environments to use RUSTC_WRAPPER - Store Homebrew's rustflags in HOMEBREW_RUSTFLAGS instead of RUSTFLAGS 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Carlo Cabrera <github@carlo.cab>
5a5392f
to
e6ba71c
Compare
Summary
rustc_wrapper
shim that usesRUSTC_WRAPPER
instead of settingRUSTFLAGS
directly.cargo/config.toml
settingsRUSTFLAGS
Implementation Details
rustc_wrapper
shim inshims/super/
that clearsRUSTFLAGS
and prependsHOMEBREW_RUSTFLAGS
std
andsuper
environments to useRUSTC_WRAPPER
pointing to the shimRUSTFLAGS
toHOMEBREW_RUSTFLAGS
to avoid direct environment conflictsTest plan
.cargo/config.toml
settings are respected🤖 Generated with Claude Code