From 39e30a7287542b1ae7b1c298c3c0f1c70ef0a636 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 14 Sep 2026 23:38:30 -0400 Subject: [PATCH] Store Rust linker configuration in a provider Replace the struct returned by _get_linker_config with _LinkerConfigInfo, declaring the seven fields consumed by the linker argument and environment helpers. Validation: buildifier -mode=check and git diff --check pass. Assisted-by: OpenAI Codex --- rust/private/rustc.bzl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl index a7006fb429..34a3251999 100644 --- a/rust/private/rustc.bzl +++ b/rust/private/rustc.bzl @@ -406,6 +406,16 @@ def get_linker_and_args(ctx, crate_type, toolchain, cc_toolchain, feature_config _get_linker_env(linker_config), ) +_LinkerConfigInfo = provider(fields = [ + "action_name", + "feature_configuration", + "is_direct_driver", + "rpaths", + "rust_linker", + "target_arch", + "variables", +]) + def _get_linker_config(ctx, crate_type, toolchain, cc_toolchain, feature_configuration, rpaths, add_flags_for_binary): user_link_flags = get_cc_user_link_flags(ctx) @@ -451,7 +461,7 @@ def _get_linker_config(ctx, crate_type, toolchain, cc_toolchain, feature_configu # Keep CcToolchainVariables and the Rust linker File until map_each runs so # cc_common and File.path use the Rustc action's path mapper. - return struct( + return _LinkerConfigInfo( feature_configuration = feature_configuration, action_name = action_name, variables = link_variables,