From ffb37095f29ebeff047a6c01f41a7a0d1703580e Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Thu, 4 Jan 2024 13:50:38 +0000 Subject: [PATCH 1/2] Fix name of toolchain repo It looks like we register these as _tools not as _srcs, this looks like it was maybe a typo in https://github.com/bazelbuild/rules_rust/pull/1528 --- rust/repositories.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/repositories.bzl b/rust/repositories.bzl index 99e5249419..c339fa206f 100644 --- a/rust/repositories.bzl +++ b/rust/repositories.bzl @@ -200,7 +200,7 @@ def rust_register_toolchains( ) toolchain_names.append(rust_analyzer_repo_name) - toolchain_labels[rust_analyzer_repo_name] = "@{}_srcs//:rust_analyzer_toolchain".format( + toolchain_labels[rust_analyzer_repo_name] = "@{}_tools//:rust_analyzer_toolchain".format( rust_analyzer_repo_name, ) exec_compatible_with_by_toolchain[rust_analyzer_repo_name] = [] From 96422a180d960ef307bca57108c308f8a214fbbe Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Thu, 4 Jan 2024 13:55:51 +0000 Subject: [PATCH 2/2] Add test --- examples/bzlmod/hello_world/BUILD.bazel | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/bzlmod/hello_world/BUILD.bazel b/examples/bzlmod/hello_world/BUILD.bazel index 3c05e162f0..f76873467f 100644 --- a/examples/bzlmod/hello_world/BUILD.bazel +++ b/examples/bzlmod/hello_world/BUILD.bazel @@ -1,3 +1,4 @@ +load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_doc") package(default_visibility = ["//visibility:public"]) @@ -48,3 +49,10 @@ rust_binary( "vendored", ] ] + +build_test( + name = "gen_rust_project", + targets = [ + "@rules_rust//tools/rust_analyzer:gen_rust_project", + ], +)