Fetch each component of a Rust release on demand (#4397) This change splits a toolchain's downloads by component so a build only fetches what it uses, and extracts the compiler once per execution platform instead of once per target triple. `rust_toolchain_tools_repository` takes `components`, the archives to download, and labels for the repositories holding the rest. `rust_repository_set` creates, per channel: * `<name>__<channel>__rustc`: the compiler, the tools beside it and the standard library of the execution platform, shared by every target triple. * `<name>__<channel>__cargo` and `<name>__<channel>__clippy`: fetched only when a `cargo_toolchain` or `clippy_toolchain` is analyzed. * `<name>__<target_triple>__<channel>_tools`: the toolchain declarations and, for a target other than the execution platform, its standard library. The hub and proxy repositories are unchanged. `rust_host_tools` stays in one repository because crate_universe reads `bin/cargo` from it by path. A rustc driver loads `librustc_driver` relative to its own real path, so the Clippy repository links the compiler's `lib/` (and its DLLs on Windows) beside `clippy-driver` when it is fetched. The generated `rust_toolchain` drops the deprecated `cargo` attribute, which would have fetched Cargo for every build; `$(CARGO)` comes from the `cargo_toolchain`. The default tool templates of `crates_repository` and `cargo_bootstrap_repository` follow the new names. A `rust_library` build from an empty output base now fetches the compiler repository, the declarations repository and the hub, nothing else.
This repository provides rules for building Rust projects with Bazel.
The fastest way to try this in an empty project is to click the green “Use this template” button on https://github.com/bazel-starters/rust.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.
Please refer to the full documentation.