Skip to content

Commit

Permalink
Prepare rust rules for Starlark CcToolchainInfo. (#2424)
Browse files Browse the repository at this point in the history
  • Loading branch information
buildbreaker2021 authored Jan 16, 2024
1 parent 9a6f5c8 commit 50b9ef3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,15 @@ def collect_inputs(
"""
linker_script = getattr(file, "linker_script") if hasattr(file, "linker_script") else None

linker_depset = cc_toolchain.linker_files()
# TODO: As of writing this comment Bazel used Java CcToolchainInfo.
# However there is ongoing work to rewrite provider in Starlark.
# rules_rust is not coupled with Bazel release. Remove conditional and change to
# _linker_files once Starlark CcToolchainInfo is visible to Bazel.
# https://github.com/bazelbuild/rules_rust/issues/2425
if hasattr(cc_toolchain, "_linker_files"):
linker_depset = cc_toolchain._linker_files
else:
linker_depset = cc_toolchain.linker_files()
compilation_mode = ctx.var["COMPILATION_MODE"]

use_pic = _should_use_pic(cc_toolchain, feature_configuration, crate_info.type, compilation_mode)
Expand Down

0 comments on commit 50b9ef3

Please sign in to comment.