diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index 84175d2130..1e4cfdbc68 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -681,7 +681,7 @@ def construct_arguments( env["RULES_RUST_THIRD_PARTY_DIR"] = str(toolchain._third_party_dir).lower() # extra_rustc_flags apply to the target configuration, not the exec configuration. - if hasattr(ctx.attr, "_extra_rustc_flags") and is_exec_configuration(ctx): + if hasattr(ctx.attr, "_extra_rustc_flags") and not is_exec_configuration(ctx): rustc_flags.add_all(ctx.attr._extra_rustc_flags[ExtraRustcFlagsInfo].extra_rustc_flags) # Create a struct which keeps the arguments separate so each may be tuned or diff --git a/rust/private/utils.bzl b/rust/private/utils.bzl index 4f9079b2e3..14dab65299 100644 --- a/rust/private/utils.bzl +++ b/rust/private/utils.bzl @@ -368,7 +368,7 @@ def is_exec_configuration(ctx): """ # TODO(djmarcin): Is there any better way to determine cfg=exec? - return ctx.genfiles_dir.path.find("-exec-") == -1 + return ctx.genfiles_dir.path.find("-exec-") != -1 def transform_deps(deps): """Conditionally transform a [Target] into [DepVariantInfo].