When running downstream builds utilizing rules_rust against Bazel 10 (e.g. HEAD / latest green commits), evaluation of the rust_host_tools module extension unconditionally crashes with an invalid attribute type error.
ERROR: .../external/rules_rust+/rust/extensions.bzl:272:44: Traceback (most recent call last):
File ".../external/rules_rust+/rust/extensions.bzl", line 272, column 44, in _rust_host_tools_impl
rust_toolchain_tools_repository(
Error in repository_rule: unexpected Starlark value: <sort_key> (of type sort_key)
How to test it
I used USE_BAZEL_VERSION=last_green bazel build //... inside Bazel Examples, for this repo: https://github.com/bazelbuild/examples/tree/main/rust-examples/05-deps-cargo.
The error can also be seen at the Bazel Downstream.
How I temporarily fixed it in Bazel Examples
By adding patch at MODULE.bazel:
archive_override(
module_name = "rules_rust",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.65.0/rules_rust-0.65.0.tar.gz"],
patch_cmds = ["sed -i.bak 's/for key in dir(host_tools)/for key in [\"name\", \"version\", \"allocator_library\", \"dev_components\", \"edition\", \"rustfmt_version\", \"sha256s\", \"urls\"] if hasattr(host_tools, key)/' rust/extensions.bzl"],
)
When running downstream builds utilizing
rules_rustagainst Bazel 10 (e.g. HEAD / latest green commits), evaluation of therust_host_toolsmodule extension unconditionally crashes with an invalid attribute type error.How to test it
I used
USE_BAZEL_VERSION=last_green bazel build //...inside Bazel Examples, for this repo: https://github.com/bazelbuild/examples/tree/main/rust-examples/05-deps-cargo.The error can also be seen at the Bazel Downstream.
How I temporarily fixed it in Bazel Examples
By adding patch at
MODULE.bazel: