brew/Library/Homebrew/shims/super/rustc_wrapper
Mike McQuaid e6ba71c5b1
Add rustc wrapper shim to fix RUSTFLAGS conflicts
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>
2025-08-06 17:06:25 +01:00

16 lines
525 B
Bash
Executable File

#!/bin/bash
# Prepend HOMEBREW_RUSTFLAGS to rustc arguments if set.
# This allows Homebrew to pass optimization flags while still respecting
# .cargo/config.toml (which sets RUSTFLAGS).
# rustc is passed as the first argument to RUSTC_WRAPPER
# https://doc.rust-lang.org/cargo/reference/environment-variables.html
RUSTC="${1}"
shift
# Prepend HOMEBREW_RUSTFLAGS to the arguments if set.
# HOMEBREW_RUSTFLAGS is set in extend/ENV/{std,super}.rb
# shellcheck disable=SC2086,SC2154
exec "${RUSTC}" ${HOMEBREW_RUSTFLAGS} "$@"