From d139a0c686cf74a2888cc733b834b4af684aa702 Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Sat, 17 Sep 2022 11:13:14 +0100 Subject: [PATCH] Only registry toolchains from top module Because toolchain registration is global, the top level module should control this. Otherwise if one module wants to use a rust toolchain for development and testing of that module, it will also get registered when used as a dependency. This will result in a lot of rust versions being registered, but the usage of that rust version would not even be encapsulated within that module. --- extensions.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions.bzl b/extensions.bzl index 826f922c2f..3448059c89 100644 --- a/extensions.bzl +++ b/extensions.bzl @@ -4,9 +4,9 @@ load("//rust:repositories.bzl", "rust_register_toolchains", "get_toolchain_repos load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def _toolchains_impl(ctx): - for mod in ctx.modules: - for toolchain in mod.tags.toolchain: - rust_register_toolchains(edition = toolchain.edition, register_toolchains = False) + mod = ctx.modules[0] + for toolchain in mod.tags.toolchain: + rust_register_toolchains(edition = toolchain.edition, register_toolchains = False) toolchain_repos = [] for exec_triple, name in DEFAULT_TOOLCHAIN_TRIPLES.items(): toolchain_repos += get_toolchain_repositories(name = name, exec_triple = exec_triple, extra_target_triples = [])