Repository navigation
feat(spirv-builder): warn when RUSTGPU_CODEGEN_ARGS replaces extra_args - #697
Closed
sorinirimies wants to merge 2 commits into
Closed
sorinirimies wants to merge 2 commits into
sorinirimies wants to merge 2 commits into
Conversation
added 2 commits
November 7, 2026 16:26
`invoke_rustc` was ~270 lines mixing env var reads, flag building and running cargo, so flag building was only tested through difftests. - `RUSTGPU_*` env vars are read once into `EnvOverrides`. - New pure `rustflags`, `llvm_args` and `target_features` methods, with unit tests. No behavior change: the resulting rustc invocation is identical.
`RUSTGPU_CODEGEN_ARGS` silently replaces any `SpirvBuilder::extra_arg`s, so e.g. setting it for a `--dump-*` flag drops args the build relies on. Now emits a warning listing the ignored args (as `cargo::warning` when forwarding warnings from a build script, else via `log::warn!`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RUSTGPU_CODEGEN_ARGSreplacesSpirvBuilder::extra_args(documented on the field, but easy to miss): setting it ad hoc, e.g.RUSTGPU_CODEGEN_ARGS=--dump-post-link=...for debugging, silently drops codegen args the build depends on. Behavior unchanged; now it says so.invoke_rustc env_overrides = EnvOverrides { .. } + if let Some(warning) = self.ignored_extra_args_warning(&env_overrides) + forward_rustc_warnings ? println!("cargo::warning={warning}") : log::warn!("{warning}") rustflags = self.rustflags(..)Evidence
New test
tests::rustflags::warns_about_extra_args_replaced_by_env_codegen_args— warns only when both are set.cargo test -p spirv-builder --features watch,clap: 9 passed. Clippy-D warningsclean.Merge Danger
Door: two-way
Blast Radius: tiny — one extra warning line, only when both are set. Builds with
-Dwarningson the outer build script are unaffected (cargo::warningisn't a lint).