Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,10 @@ def collect_inputs(
# Pass linker inputs only for linking-like actions, not for example where
# the output is rlib. This avoids quadratic behavior where transitive noncrates are
# flattened on each transitive rust_library dependency.
is_linking_action = crate_info.type not in ("lib", "rlib") or include_linker_inputs
libs_from_linker_inputs = []
ambiguous_libs = {}
if crate_info.type not in ("lib", "rlib") or include_linker_inputs:
if is_linking_action:
linker_inputs = dep_info.transitive_noncrates.to_list()
ambiguous_libs = _disambiguate_libs(ctx.actions, toolchain, crate_info, dep_info, use_pic)
libs_from_linker_inputs = _collect_libs_from_linker_inputs(linker_inputs, use_pic) + [
Expand Down Expand Up @@ -789,7 +790,7 @@ def collect_inputs(
crate_info.compile_data,
dep_info.transitive_proc_macro_data,
toolchain.all_files,
] + ([] if experimental_use_cc_common_link else [
] + ([] if experimental_use_cc_common_link or not is_linking_action else [
runtime_libs,
linker_depset,
]),
Expand Down
4 changes: 1 addition & 3 deletions rust/private/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,8 @@ def _rust_toolchain_impl(ctx):
std,
)

# Include C++ toolchain files to ensure tools like 'ar' are available for cross-compilation
# C++ toolchain inputs are attached to the Rust actions that use them.
all_files_depsets = [sysroot.all_files]
if cc_toolchain and cc_toolchain.all_files:
all_files_depsets.append(cc_toolchain.all_files)

# Parse the version string once so downstream rules can branch on the
# semver components without re-parsing. `None` for empty or non-semver
Expand Down
Loading