You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though rust_register_toolchains suggests this is possible
extra_rustc_flags (dict, list, optional): Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration.
It fails with the following error:
File "/foo/bar/baz/external/rules_rust/rust/repositories.bzl", line 1053, column 50, in rust_repository_set
extra_rustc_flags = extra_rustc_flags.get(toolchain.target_triple) if extra_rustc_flags != None else None,
Error: 'list' value has no field or method 'get'
The following patch seems to fix it:
@@ -1040,6 +1040,17 @@ 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,
@@ -1050,7 +1061,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,
The text was updated successfully, but these errors were encountered:
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>
It's currently impossible to specify a
list
ofextra_rustc_flags
in the toolchain:Even though
rust_register_toolchains
suggests this is possibleIt fails with the following error:
The following patch seems to fix it:
The text was updated successfully, but these errors were encountered: