Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nfc] setting up rustfmt and rust analyzer repositories #3071

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,33 @@ 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
# targets being generated for the extra triple as part of the toolchain. Setting this explicitly
# 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()
Expand Down