Repository navigation
feat(spirv-builder): add RUSTGPU_ENCODED_RUSTFLAGS and RUSTGPU_ENCODED_CARGOFLAGS - #696
Closed
sorinirimies wants to merge 3 commits into
Closed
sorinirimies wants to merge 3 commits into
sorinirimies wants to merge 3 commits into
Conversation
added 3 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.
…D_CARGOFLAGS `RUSTGPU_RUSTFLAGS` / `RUSTGPU_CARGOFLAGS` are split on whitespace, so a single flag can't contain a space (e.g. a path). Like Cargo's `CARGO_ENCODED_RUSTFLAGS`, the new `RUSTGPU_ENCODED_*` variants are split on `\x1f` and take precedence over the plain ones.
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_RUSTFLAGSandRUSTGPU_CARGOFLAGSare split on whitespace, so no flag can contain a space — e.g.--remap-path-prefix=/Users/me/My Projects=/srcor a--configvalue. Cargo solved the same problem forRUSTFLAGSwithCARGO_ENCODED_RUSTFLAGS; this mirrors it:RUSTGPU_ENCODED_RUSTFLAGS\x1fRUSTGPU_RUSTFLAGSRUSTGPU_ENCODED_CARGOFLAGS\x1fRUSTGPU_CARGOFLAGSEmpty encoded value = no flags (as in Cargo). Both new vars emit
cargo:rerun-if-env-changed.RUSTGPU_CODEGEN_ARGSgets no encoded variant: codegen args are passed space-joined in-Cllvm-args=..., so they can't contain spaces anyway.EnvOverrides { - rustflags: Option<String>, // split_whitespace at use site - cargoflags: Option<String>, + rustflags: Option<Vec<String>>, // split_env_flags(ENCODED, plain) + cargoflags: Option<Vec<String>>, }Evidence
New
tests::env_flags:cargo test -p spirv-builder --features watch,clap: 12 passed. Clippy-D warningsclean.Merge Danger
Door: two-way (new opt-in env vars; easy to remove before a release)
Blast Radius: none unless the new variables are set.