Skip to content

Commit

Permalink
Only registry toolchains from top module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cameron-martin committed Sep 17, 2022
1 parent ba72334 commit d139a0c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
Expand Down

0 comments on commit d139a0c

Please sign in to comment.