From 5ad580576285e44e600d78932fe68b1e83ee31e1 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Wed, 6 Nov 2024 10:00:53 -0800 Subject: [PATCH] [nfc] setting up rustfmt and rust analyzer repositories --- WORKSPACE | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 3b3f86aac96..41fb2a793e0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -179,10 +179,12 @@ git_repository( remote = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git", ) -load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains") +load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_analyzer_toolchain_repository", "rust_register_toolchains", "rustfmt_toolchain_repository") rules_rust_dependencies() +RUST_VERSION = "1.82.0" # LLVM 19 + rust_register_toolchains( edition = "2021", # Add support macOS cross-compilation, the overhead for this is limited with only a few more @@ -190,9 +192,20 @@ rust_register_toolchains( # also avoids registering support for the wasm32-unknown-unknown and wasm32-wasi targets, which # are otherwise added by default. extra_target_triples = ["x86_64-apple-darwin"], - versions = ["1.82.0"], # LLVM 19 + versions = [RUST_VERSION], ) +register_toolchains(rust_analyzer_toolchain_repository( + name = "rust-analyzer", + version = RUST_VERSION, +)) + +register_toolchains(rustfmt_toolchain_repository( + name = "rustfmt", + exec_triple = "x86_64-unknown-linux-gnu", + version = RUST_VERSION, +)) + load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") crate_universe_dependencies()