Skip to content

Commit f569827

Browse files
authored
Fix rust_doc_test using execpath paths instead of rootpath (#1129)
1 parent 48f97b3 commit f569827

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

rust/private/rustdoc.bzl

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def rustdoc_compile_action(
4848
toolchain,
4949
crate_info,
5050
output = None,
51-
rustdoc_flags = []):
51+
rustdoc_flags = [],
52+
is_test = False):
5253
"""Create a struct of information needed for a `rustdoc` compile action based on crate passed to the rustdoc rule.
5354
5455
Args:
@@ -57,6 +58,7 @@ def rustdoc_compile_action(
5758
crate_info (CrateInfo): The provider of the crate passed to a rustdoc rule.
5859
output (File, optional): An optional output a `rustdoc` action is intended to produce.
5960
rustdoc_flags (list, optional): A list of `rustdoc` specific flags.
61+
is_test (bool, optional): If True, the action will be configured for `rust_doc_test` targets
6062
6163
Returns:
6264
struct: A struct of some `ctx.actions.run` arguments.
@@ -102,7 +104,7 @@ def rustdoc_compile_action(
102104
attr = ctx.attr,
103105
file = ctx.file,
104106
toolchain = toolchain,
105-
tool_path = toolchain.rust_doc.path,
107+
tool_path = toolchain.rust_doc.short_path if is_test else toolchain.rust_doc.path,
106108
cc_toolchain = cc_toolchain,
107109
feature_configuration = feature_configuration,
108110
crate_info = rustdoc_crate_info,

rust/private/rustdoc_test.bzl

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def _rust_doc_test_impl(ctx):
116116
toolchain = find_toolchain(ctx),
117117
crate_info = crate_info,
118118
rustdoc_flags = rustdoc_flags,
119+
is_test = True,
119120
)
120121

121122
tools = action.tools + [ctx.executable._process_wrapper]

0 commit comments

Comments
 (0)