Skip to content

Commit b1a7e1a

Browse files
author
Vinh Tran
committed
Add _experimental_toolchain_generated_sysroot to rustdoc
1 parent 849c6c6 commit b1a7e1a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

rust/private/rustc.bzl

+5-3
Original file line numberDiff line numberDiff line change
@@ -965,9 +965,8 @@ def construct_arguments(
965965
if linker_script:
966966
rustc_flags.add(linker_script, format = "--codegen=link-arg=-T%s")
967967

968-
if hasattr(ctx.attr, "_experimental_toolchain_generated_sysroot"):
969-
if ctx.attr._experimental_toolchain_generated_sysroot[BuildSettingInfo].value == True:
970-
rustc_flags.add("--sysroot", toolchain.sysroot)
968+
if attr._experimental_toolchain_generated_sysroot[BuildSettingInfo].value == True:
969+
rustc_flags.add("--sysroot", toolchain.sysroot)
971970

972971
# Tell Rustc where to find the standard library (or libcore)
973972
rustc_flags.add_all(toolchain.rust_std_paths, before_each = "-L", format_each = "%s")
@@ -1042,6 +1041,9 @@ def construct_arguments(
10421041
data_paths,
10431042
))
10441043

1044+
# Ensure the sysroot is set for the target platform
1045+
env["SYSROOT"] = toolchain.sysroot
1046+
10451047
if toolchain._rename_first_party_crates:
10461048
env["RULES_RUST_THIRD_PARTY_DIR"] = toolchain._third_party_dir
10471049

rust/private/rustdoc.bzl

+7
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,13 @@ rust_doc = rule(
321321
"_error_format": attr.label(
322322
default = Label("//:error_format"),
323323
),
324+
"_experimental_toolchain_generated_sysroot": attr.label(
325+
default = Label("//rust/settings:experimental_toolchain_generated_sysroot"),
326+
doc = (
327+
"Label to a boolean build setting that lets the rule knows wheter to set --sysroot to rustc" +
328+
"This flag is only relevant when used together with --@rules_rust//rust/settings:experimental_toolchain_generated_sysroot."
329+
),
330+
),
324331
"_process_wrapper": attr.label(
325332
doc = "A process wrapper for running rustdoc on all platforms",
326333
default = Label("@rules_rust//util/process_wrapper"),

0 commit comments

Comments
 (0)