Skip to content

Commit 2bdcf9c

Browse files
committed
Build junit_runner in the exec configuration
junit_runner is a test-support tool, like process_wrapper and the coverage collector, so build it the way they are -- in the exec configuration. As a target-configuration dependency it inherited target-only settings it can't satisfy: a workspace that pairs a custom #[global_allocator] with cc_common.link (rules_rust's own test/integration/cc_common_link_with_global_alloc) failed to link the runner, because it has no global allocator of its own to supply the allocator symbols. Building it for the exec platform keeps it off the target configuration, which is where it belongs anyway -- it's the test's launcher, it runs wherever the test is executed, and it has no reason to match the tested crate's build settings.
1 parent 29d6abd commit 2bdcf9c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

rust/private/rust.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,12 @@ _RUST_TEST_ATTRS = {
10431043
"_junit_runner": attr.label(
10441044
default = Label("//util/junit_runner"),
10451045
executable = True,
1046-
cfg = "target",
1046+
# Built for the exec platform, like the other test-support tools
1047+
# (process_wrapper, collect_coverage). This keeps the runner off the
1048+
# target configuration, so it doesn't inherit target-only settings such
1049+
# as a custom #[global_allocator] or cc_common.link, which it has no way
1050+
# to satisfy and which would otherwise fail to link.
1051+
cfg = "exec",
10471052
),
10481053
} | _COVERAGE_ATTRS | _EXPERIMENTAL_USE_CC_COMMON_LINK_ATTRS
10491054

0 commit comments

Comments
 (0)