add rustc setting use_default_shell_env#4009
add rustc setting use_default_shell_env#4009oliverlee wants to merge 1 commit intobazelbuild:mainfrom
use_default_shell_env#4009Conversation
`//rust/settings:use_default_shell_env` is a bool flag that controls whether rustc actions inherit the shell environment. The default is `False` to maintain existing behavior. This allows use in environments where PATH is set outside of Bazel's action environment, e.g. when using a Nix-based CcToolchain that relies on a Nix shell to populate PATH.
UebelAndre
left a comment
There was a problem hiding this comment.
Thanks! This seems like a reasonable compromise 😄
Just one question.
| "_rustc_output_diagnostics": attr.label( | ||
| default = Label("//rust/settings:rustc_output_diagnostics"), | ||
| ), | ||
| "_use_default_shell_env": attr.label( |
There was a problem hiding this comment.
Would it make more sense to have this on rust_toolchain?
There was a problem hiding this comment.
I'm fine with either a toolchain flag or a global setting, although it seems unlikely a project would have multiple Rust toolchains where only some need the default shell env.
However, I don't have deep rules_rust experience, so feel free to disregard — at my day job I use Rust to build some tooling, though only ever with a single Rust toolchain.
There was a problem hiding this comment.
We currently have a big number of flags on the toolchain and feel it's much easier to manage having it there
Lines 637 to 651 in 71470d7
Both work but if there's no string feelings or technical rationale (which I'm amenable to here) I'd prefer to have it on the toolchain
There was a problem hiding this comment.
Sure I can take a look at it next week.
//rust/settings:use_default_shell_envis a bool flag that controls whether rustc actions inherit the shell environment. The default isFalseto maintain existing behavior.This allows use in environments where PATH is set outside of Bazel's action environment, e.g. when using a Nix-based CcToolchain that relies on a Nix shell to populate PATH.