You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rust_toolchain: expand Make variables in flags (#3640)
This allows a user to say:
```bzl
rust_register_toolchains( # or rust_toolchain(
extra_rustc_flags = {
"aarch64-unknown-linux-gnu": [
"--codegen=link-arg=-B$(RUST_SYSROOT)/lib/rustlib/aarch64-unknown-linux-gnu/bin/gcc-ld",
"--codegen=link-arg=-fuse-ld=lld",
],
"x86_64-unknown-linux-gnu": [
"--codegen=link-arg=-B$(RUST_SYSROOT)/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld",
"--codegen=link-arg=-fuse-ld=lld",
],
},
)
```
bringing us one step closer to #3602.
This is **technically** an incompatible change: if a user currently sets
a `extra_rustc_flags` containing `$`, they now need to escape `$` to
`$$` pursuant to how [Make variable
expansion](https://bazel.build/reference/be/make-variables) works in
Bazel. However, I would assume this is rare.
Inspired by #3540 – cc
@krasimirgg
doc="Label to a boolean build setting that controls whether cc_common.link is used to link rust binaries.",
844
853
),
845
854
"extra_exec_rustc_flags": attr.string_list(
846
-
doc="Extra flags to pass to rustc in exec configuration. Subject to location expansion with respect to the srcs of the `rust_std` attribute.",
855
+
doc="Extra flags to pass to rustc in exec configuration. Subject to location expansion with respect to the srcs of the `rust_std` attribute. Subject to Make variable expansion with respect to RUST_SYSROOT, RUST_SYSROOT_SHORT, RUSTC, etc.",
847
856
),
848
857
"extra_rustc_flags": attr.string_list(
849
-
doc="Extra flags to pass to rustc in non-exec configuration. Subject to location expansion with respect to the srcs of the `rust_std` attribute.",
858
+
doc="Extra flags to pass to rustc in non-exec configuration. Subject to location expansion with respect to the srcs of the `rust_std` attribute. Subject to Make variable expansion with respect to RUST_SYSROOT, RUST_SYSROOT_SHORT, RUSTC, etc.",
0 commit comments