mirror of https://github.com/bazelbuild/rules_rust
Apply extra_rustc_flags list to all toolchains (#2693)
Fixes #2692 This fixes `rust_register_toolchains` to correctly call `rust_toolchain_repository` with a list of `extra_rustc_flags`. Previously, the `extra_rustc_flags` argument of `rust_register_toolchains` was assumed (when set) to be a dict of toolchain triple to list. With this change, a `list` parameter is used for all toolchain triples. Co-authored-by: UebelAndre <github@uebelandre.com>
This commit is contained in:
parent
bb73b64e29
commit
78c68d60d9
|
@ -1087,6 +1087,16 @@ def rust_repository_set(
|
|||
elif type(extra_target_triples) == "dict":
|
||||
target_compatible_with = extra_target_triples.get(toolchain.target_triple)
|
||||
|
||||
# Infer toolchain-specific rustc flags depending on the type (list, dict, optional) of extra_rustc_flags
|
||||
if extra_rustc_flags == None:
|
||||
toolchain_extra_rustc_flags = []
|
||||
elif type(extra_rustc_flags) == "list":
|
||||
toolchain_extra_rustc_flags = extra_rustc_flags
|
||||
elif type(extra_rustc_flags) == "dict":
|
||||
toolchain_extra_rustc_flags = extra_rustc_flags.get(toolchain.target_triple)
|
||||
else:
|
||||
fail("extra_rustc_flags should be a list or a dict")
|
||||
|
||||
all_toolchain_names.append(rust_toolchain_repository(
|
||||
name = toolchain.name,
|
||||
allocator_library = allocator_library,
|
||||
|
@ -1099,7 +1109,7 @@ def rust_repository_set(
|
|||
edition = edition,
|
||||
exec_triple = exec_triple,
|
||||
extra_exec_rustc_flags = extra_exec_rustc_flags,
|
||||
extra_rustc_flags = extra_rustc_flags.get(toolchain.target_triple) if extra_rustc_flags != None else None,
|
||||
extra_rustc_flags = toolchain_extra_rustc_flags,
|
||||
opt_level = opt_level.get(toolchain.target_triple) if opt_level != None else None,
|
||||
target_settings = target_settings,
|
||||
iso_date = toolchain.channel.iso_date,
|
||||
|
|
Loading…
Reference in New Issue