Allow specifying exec and target compatibility constraints (#1971)

Extra target triples may only be appropriate for specific platforms
(e.g. if you register a toolchain with the exec_triple
`x86_64-unknown-linux-gnu` with an extra target triple of
`x86_64-unknown-linux-musl`, you may want differing
`target_compatible_with` values for each of those two target triples.

This allows for specifying explicit `exec_compatible_with` lists per
toolchain (which was already supported by `rust_toolchain_repository`
just not proxied by `rust_repository_set`), and explicit
`target_compatible_with` lists, both for the default triple and for
extra ones.

I'm not 100% sure on our pre-existing assumption that every toolchain
supports compiling targeting its own exec platform, i.e. the
'`[exec_triple]`' part of https://github.com/bazelbuild/rules_rust/blob/937e63399b111a6d7ee53b187e4d113300b089e9/rust/repositories.bzl#L845
but it _does_ generally hold, and supplying a way of removing that
default assumption is definitely a separate PR for another day if it
becomes relevant to anyone.
3 files changed
tree: 92d9ee3371205ee19bc98ed0e728151c09124a89
  1. .bazelci/
  2. .github/
  3. bindgen/
  4. cargo/
  5. crate_universe/
  6. docs/
  7. examples/
  8. proto/
  9. rust/
  10. test/
  11. tools/
  12. util/
  13. wasm_bindgen/
  14. .bazelignore
  15. .bazelrc
  16. .clang-format
  17. .gitattributes
  18. .gitignore
  19. .rustfmt.toml
  20. ARCHITECTURE.md
  21. AUTHORS
  22. BUILD.bazel
  23. CODEOWNERS
  24. COMPATIBILITY.md
  25. CONTRIBUTING.md
  26. CONTRIBUTORS
  27. LICENSE.txt
  28. MODULE.bazel
  29. README.md
  30. version.bzl
  31. WORKSPACE.bazel
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.