diff --git a/rust/defs.bzl b/rust/defs.bzl index 1bf7f17e3c..9563656fba 100644 --- a/rust/defs.bzl +++ b/rust/defs.bzl @@ -33,7 +33,6 @@ load( _rust_shared_library = "rust_shared_library", _rust_static_library = "rust_static_library", _rust_test = "rust_test", - _rust_test_binary = "rust_test_binary", _rust_test_suite = "rust_test_suite", ) load( @@ -77,9 +76,6 @@ rust_binary = _rust_binary rust_test = _rust_test # See @rules_rust//rust/private:rust.bzl for a complete description. -rust_test_binary = _rust_test_binary -# See @rules_rust//rust/private:rust.bzl for a complete description. - rust_test_suite = _rust_test_suite # See @rules_rust//rust/private:rust.bzl for a complete description. diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl index 6fc07e5716..c00cfce39f 100644 --- a/rust/private/rust.bzl +++ b/rust/private/rust.bzl @@ -1127,32 +1127,6 @@ rust_test = rule( """), ) -rust_test_binary = rule( - implementation = _rust_test_impl, - provides = _common_providers, - attrs = dict(_common_attrs.items() + - _rust_test_attrs.items()), - executable = True, - fragments = ["cpp"], - host_fragments = ["cpp"], - toolchains = [ - str(Label("//rust:toolchain")), - "@bazel_tools//tools/cpp:toolchain_type", - ], - incompatible_use_toolchain_transition = True, - doc = dedent("""\ - Builds a Rust test binary, without marking this rule as a Bazel test. - - **Warning**: This rule is currently experimental. - - This should be used when you want to run the test binary from a different test - rule (such as [`sh_test`](https://docs.bazel.build/versions/master/be/shell.html#sh_test)), - and know that running the test binary directly will fail. - - See `rust_test` for example usage. - """), -) - def rust_test_suite(name, srcs, **kwargs): """A rule for creating a test suite for a set of `rust_test` targets. diff --git a/rust/rust.bzl b/rust/rust.bzl index f02a8855e3..f66541e060 100644 --- a/rust/rust.bzl +++ b/rust/rust.bzl @@ -31,7 +31,6 @@ load( _rust_shared_library = "rust_shared_library", _rust_static_library = "rust_static_library", _rust_test = "rust_test", - _rust_test_binary = "rust_test_binary", ) load("//rust/settings:incompatible.bzl", "fail_when_enabled") @@ -70,9 +69,6 @@ rust_binary = _rust_binary rust_test = _rust_test # See @rules_rust//rust/private:rust.bzl for a complete description. -rust_test_binary = _rust_test_binary -# See @rules_rust//rust/private:rust.bzl for a complete description. - rust_benchmark = _rust_benchmark # See @rules_rust//rust/private:rust.bzl for a complete description. diff --git a/test/rust_test_binary/BUILD.bazel b/test/rust_test_binary/BUILD.bazel deleted file mode 100644 index 5174101175..0000000000 --- a/test/rust_test_binary/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load( - "//rust:rust.bzl", - "rust_test_binary", -) - -package(default_visibility = ["//visibility:public"]) - -# Here we build the rust binary that, when run, will run our test cases. -# However, it requires some other arbitrary setup first. -# -# If this was just `rust_test`, running `bazel test //...` would fail. -rust_test_binary( - name = "rust_test_that_requires_wrapping", - srcs = ["tests/rust_test_that_requires_wrapping.rs"], -) - -# We do our arbitrary setup in another rule such as `sh_test` which can depend -# on `rust_test_binary` in its `data` attribute. -# -# This is a trivial case, but demonstrates that a rust_test_binary output can be -# executed from another test rule. -sh_test( - name = "wrapped_rust_test", - srcs = ["scripts/exec_with_test_env.sh"], - args = ["$(location :rust_test_that_requires_wrapping)"], - data = [":rust_test_that_requires_wrapping"], -) diff --git a/test/rust_test_binary/scripts/exec_with_test_env.sh b/test/rust_test_binary/scripts/exec_with_test_env.sh deleted file mode 100755 index 1e513d22ed..0000000000 --- a/test/rust_test_binary/scripts/exec_with_test_env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Run the given binary, setting up a required test environment variable. - -set -ex - -export USER_DEFINED_KEY=USER_DEFINED_VALUE - -"$@" diff --git a/test/rust_test_binary/tests/rust_test_that_requires_wrapping.rs b/test/rust_test_binary/tests/rust_test_that_requires_wrapping.rs deleted file mode 100644 index 251419bf05..0000000000 --- a/test/rust_test_binary/tests/rust_test_that_requires_wrapping.rs +++ /dev/null @@ -1,11 +0,0 @@ -use std::env; - -#[test] -pub fn rust_test_that_requires_wrapping() { - let actual = format!( - "This test requires {} at runtime.", - env::var("USER_DEFINED_KEY").unwrap() - ); - let expected = "This test requires USER_DEFINED_VALUE at runtime."; - assert_eq!(actual, expected); -}