Skip to content

Commit

Permalink
toolchain: extra_rustc_flags after target rustc flags
Browse files Browse the repository at this point in the history
Summary: So that if you pass something on the command line, it takes precedence over any package/target flags

Reviewed By: dtolnay

Differential Revision: D54976353

fbshipit-source-id: de0c21b48e4512f9efd270280310c9ccb514cd43
  • Loading branch information
JakobDegen authored and facebook-github-bot committed Mar 16, 2024
1 parent 4835f4d commit 39d2754
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions prelude/rust/build.bzl
Expand Up @@ -1015,6 +1015,7 @@ def _compute_common_args(
_rustc_flags(toolchain_info.rustc_check_flags) if is_check else [],
_rustc_flags(toolchain_info.rustc_coverage_flags) if ctx.attrs.coverage else [],
_rustc_flags(ctx.attrs.rustc_flags),
_rustc_flags(toolchain_info.extra_rustc_flags),
cmd_args(ctx.attrs.features, format = '--cfg=feature="{}"'),
dep_args,
)
Expand Down
3 changes: 3 additions & 0 deletions prelude/rust/rust_toolchain.bzl
Expand Up @@ -40,6 +40,9 @@ rust_toolchain_attrs = {
"rustc_target_triple": provider_field(str | None, default = None),
# Baseline compiler config
"rustc_flags": provider_field(list[typing.Any], default = []),
# Rustc flags, except that they are applied on the command line after the
# target's rustc flags
"extra_rustc_flags": provider_field(list[typing.Any], default = []),
# Extra flags when building binaries
"rustc_binary_flags": provider_field(list[typing.Any], default = []),
# Extra flags for doing check builds
Expand Down

0 comments on commit 39d2754

Please sign in to comment.