Skip to content

Conversation

@Geethree
Copy link

Adds support for reading Rust toolchain configuration from a rust-toolchain.toml file, allowing Bazel and cargo/rustup to share the same version specification.

Supported fields:

  • channel: Maps to versions attribute
  • targets: Merged with extra_target_triples
  • components: Sets dev_components=True if "rustc-dev" present

Supports both single-line and multi-line TOML arrays.

Fixes #2753

Adds support for reading Rust toolchain configuration from a rust-toolchain.toml file, allowing Bazel and cargo/rustup to share the same version specification.

Supported fields:
- channel: Maps to versions attribute
- targets: Merged with extra_target_triples
- components: Sets dev_components=True if "rustc-dev" present

Supports both single-line and multi-line TOML arrays.

Fixes bazelbuild#2753
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Have you thought about adding a new extension (toolchain_toml for example)? I'm wondering if it make sense in the context of a toml file to allow for varying rustfmt and rust-analyzer rustc versions, and extra target triples. Plus having attributes which end up doing nothing feels bad to me as it's easy to have side effects in future changes where both are set.

parse_rust_toolchain_file_test = unittest.make(_parse_rust_toolchain_file_test_impl)

def rust_toolchain_toml_test_suite(name):
unittest.suite(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's a bit more verbose, can you use a native.test_suite? I find it much. more readable than the enumerated tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for toolchain version from rust-toolchain.toml file

2 participants