From 3aab1ca77c926fed08ffb24c6c52b984c61f562d Mon Sep 17 00:00:00 2001 From: Grzegorz Lukasik <hauserx@gmail.com> Date: Mon, 20 Jan 2025 19:21:17 +0100 Subject: [PATCH] Don't register rust_host_tools twice The bazel-lsp uses `rust_host_tools` to perform some actions: by using: rust_host_tools = use_extension("@rules_rust//rust:extensions.bzl", "rust_host_tools") use_repo(rust_host_tools, "rust_host_tools") See: https://github.com/cameron-martin/bazel-lsp/blob/19b799e528c884be6efeb108ed1840a4edff1330/MODULE.bazel#L14 It started failing after https://github.com/bazelbuild/rules_rust/pull/3148 because rules_rust's MODULE.bazel registers toolchain with the same name: rust_host_tools.host_tools( name = "rust_host_tools", ) See: https://github.com/bazelbuild/rules_rust/blob/aae84e97c73eae2e6654e1a7e1b751d0c1f2ac9e/MODULE.bazel#L70 --- rust/extensions.bzl | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/rust/extensions.bzl b/rust/extensions.bzl index cfac64cd5a..e2b1fbbf2c 100644 --- a/rust/extensions.bzl +++ b/rust/extensions.bzl @@ -265,18 +265,6 @@ def _rust_host_tools_impl(module_ctx): **attrs ) - # If no tags were specified, create a default repository. - if not mod.tags.host_tools: - attrs = { - "name": "rust_host_tools", - "version": rust_common.default_version, - } - rust_toolchain_tools_repository( - exec_triple = host_triple.str, - target_triple = host_triple.str, - **attrs - ) - metadata_kwargs = {} if bazel_features.external_deps.extension_metadata_has_reproducible: metadata_kwargs["reproducible"] = True