Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove incompatible_test_attr_crate_and_srcs_mutually_exclusive #2641

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,10 @@ def _rust_test_impl(ctx):
deps = transform_deps(ctx.attr.deps)
proc_macro_deps = transform_deps(ctx.attr.proc_macro_deps + get_import_macro_deps(ctx))

if toolchain._incompatible_test_attr_crate_and_srcs_mutually_exclusive:
if ctx.attr.crate and ctx.attr.srcs:
fail("rust_test.crate and rust_test.srcs are mutually exclusive. Update {} to use only one of these attributes".format(
ctx.label,
))
if ctx.attr.crate and ctx.attr.srcs:
fail("rust_test.crate and rust_test.srcs are mutually exclusive. Update {} to use only one of these attributes".format(
ctx.label,
))

if ctx.attr.crate:
# Target is building the crate in `test` config
Expand Down
7 changes: 0 additions & 7 deletions rust/settings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ incompatible_flag(
issue = "https://github.com/bazelbuild/rules_rust/issues/2039",
)

# A flag to make `rust_test.crate` and `rust_test.srcs` mutually exclusive.
incompatible_flag(
name = "incompatible_test_attr_crate_and_srcs_mutually_exclusive",
build_setting_default = True,
issue = "https://github.com/bazelbuild/rules_rust/issues/2324",
)

# A flag to control whether to link libstd dynamically.
bool_flag(
name = "experimental_link_std_dylib",
Expand Down
4 changes: 0 additions & 4 deletions rust/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ def _rust_toolchain_impl(ctx):
_experimental_use_coverage_metadata_files = ctx.attr._experimental_use_coverage_metadata_files[BuildSettingInfo].value,
_experimental_toolchain_generated_sysroot = ctx.attr._experimental_toolchain_generated_sysroot[IncompatibleFlagInfo].enabled,
_incompatible_no_rustc_sysroot_env = ctx.attr._incompatible_no_rustc_sysroot_env[IncompatibleFlagInfo].enabled,
_incompatible_test_attr_crate_and_srcs_mutually_exclusive = ctx.attr._incompatible_test_attr_crate_and_srcs_mutually_exclusive[IncompatibleFlagInfo].enabled,
_no_std = no_std,
)
return [
Expand Down Expand Up @@ -863,9 +862,6 @@ rust_toolchain = rule(
"_incompatible_no_rustc_sysroot_env": attr.label(
default = Label("//rust/settings:incompatible_no_rustc_sysroot_env"),
),
"_incompatible_test_attr_crate_and_srcs_mutually_exclusive": attr.label(
default = Label("//rust/settings:incompatible_test_attr_crate_and_srcs_mutually_exclusive"),
),
"_no_std": attr.label(
default = Label("//:no_std"),
),
Expand Down