Updated all toolchain_type definitions to be named `toolchain_type`. (#1479)
* Updated all toolchain_type definitions to be named `toolchain_type`.
* Regenerate documentation
* Added deprecation warnings
diff --git a/bindgen/BUILD.bazel b/bindgen/BUILD.bazel
index 8096c89..c0872af 100644
--- a/bindgen/BUILD.bazel
+++ b/bindgen/BUILD.bazel
@@ -3,7 +3,16 @@
package(default_visibility = ["//visibility:public"])
-toolchain_type(name = "bindgen_toolchain")
+toolchain_type(
+ name = "toolchain_type",
+)
+
+alias(
+ name = "bindgen_toolchain",
+ actual = "toolchain_type",
+ deprecation = "instead use `@rules_rust//bindgen:toolchain_type`",
+ tags = ["manual"],
+)
bzl_library(
name = "bzl_lib",
@@ -43,5 +52,5 @@
toolchain(
name = "default_bindgen_toolchain",
toolchain = "default_bindgen_toolchain_impl",
- toolchain_type = "//bindgen:bindgen_toolchain",
+ toolchain_type = "//bindgen:toolchain_type",
)
diff --git a/bindgen/bindgen.bzl b/bindgen/bindgen.bzl
index b793cd0..58288d8 100644
--- a/bindgen/bindgen.bzl
+++ b/bindgen/bindgen.bzl
@@ -92,7 +92,7 @@
if header not in cc_header_list:
fail("Header {} is not in {}'s transitive headers.".format(ctx.attr.header, cc_lib), "header")
- toolchain = ctx.toolchains[Label("//bindgen:bindgen_toolchain")]
+ toolchain = ctx.toolchains[Label("//bindgen:toolchain_type")]
bindgen_bin = toolchain.bindgen
rustfmt_bin = toolchain.rustfmt or rust_toolchain.rustfmt
clang_bin = toolchain.clang
@@ -214,8 +214,8 @@
outputs = {"out": "%{name}.rs"},
fragments = ["cpp"],
toolchains = [
- str(Label("//bindgen:bindgen_toolchain")),
- str(Label("//rust:toolchain")),
+ str(Label("//bindgen:toolchain_type")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -253,7 +253,7 @@
toolchain(
name = "bindgen_toolchain",
toolchain = "bindgen_toolchain_impl",
- toolchain_type = "@rules_rust//bindgen:bindgen_toolchain",
+ toolchain_type = "@rules_rust//bindgen:toolchain_type",
)
```
diff --git a/cargo/cargo_build_script.bzl b/cargo/cargo_build_script.bzl
index dfd4fd0..87ee88e 100644
--- a/cargo/cargo_build_script.bzl
+++ b/cargo/cargo_build_script.bzl
@@ -302,7 +302,7 @@
},
fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
diff --git a/crate_universe/private/crates_vendor.bzl b/crate_universe/private/crates_vendor.bzl
index fa6a66f..021ffc3 100644
--- a/crate_universe/private/crates_vendor.bzl
+++ b/crate_universe/private/crates_vendor.bzl
@@ -36,7 +36,7 @@
return "{}/{}".format(runtime_pwd_var, path)
def _is_windows(ctx):
- toolchain = ctx.toolchains[Label("@rules_rust//rust:toolchain")]
+ toolchain = ctx.toolchains[Label("@rules_rust//rust:toolchain_type")]
return "windows" in toolchain.target_triple
def _get_output_package(ctx):
@@ -175,7 +175,7 @@
return args, runfiles
def _crates_vendor_impl(ctx):
- toolchain = ctx.toolchains[Label("@rules_rust//rust:toolchain")]
+ toolchain = ctx.toolchains[Label("@rules_rust//rust:toolchain_type")]
is_windows = _is_windows(ctx)
environ = {
@@ -400,7 +400,7 @@
),
},
executable = True,
- toolchains = ["@rules_rust//rust:toolchain"],
+ toolchains = ["@rules_rust//rust:toolchain_type"],
)
def _crates_vendor_remote_repository_impl(repository_ctx):
diff --git a/docs/flatten.md b/docs/flatten.md
index 27287f6..150e768 100644
--- a/docs/flatten.md
+++ b/docs/flatten.md
@@ -371,7 +371,7 @@
toolchain(
name = "bindgen_toolchain",
toolchain = "bindgen_toolchain_impl",
- toolchain_type = "@rules_rust//bindgen:bindgen_toolchain",
+ toolchain_type = "@rules_rust//bindgen:toolchain_type",
)
```
@@ -1301,7 +1301,7 @@
toolchain(
name = "wasm_bindgen_toolchain",
toolchain = "wasm_bindgen_toolchain_impl",
- toolchain_type = "@rules_rust//wasm_bindgen:wasm_bindgen_toolchain",
+ toolchain_type = "@rules_rust//wasm_bindgen:toolchain_type",
)
```
diff --git a/docs/rust_bindgen.md b/docs/rust_bindgen.md
index 19eaafb..3e28248 100644
--- a/docs/rust_bindgen.md
+++ b/docs/rust_bindgen.md
@@ -87,7 +87,7 @@
toolchain(
name = "bindgen_toolchain",
toolchain = "bindgen_toolchain_impl",
- toolchain_type = "@rules_rust//bindgen:bindgen_toolchain",
+ toolchain_type = "@rules_rust//bindgen:toolchain_type",
)
```
diff --git a/docs/rust_proto.md b/docs/rust_proto.md
index 8ef0a3a..2f7b40c 100644
--- a/docs/rust_proto.md
+++ b/docs/rust_proto.md
@@ -77,7 +77,7 @@
toolchain(
name = "proto-toolchain",
toolchain = ":proto-toolchain-impl",
- toolchain_type = "@rules_rust//proto:toolchain",
+ toolchain_type = "@rules_rust//proto:toolchain_type",
)
```
diff --git a/docs/rust_proto.vm b/docs/rust_proto.vm
index 9067510..b7f08f4 100644
--- a/docs/rust_proto.vm
+++ b/docs/rust_proto.vm
@@ -68,7 +68,7 @@
toolchain(
name = "proto-toolchain",
toolchain = ":proto-toolchain-impl",
- toolchain_type = "@rules_rust//proto:toolchain",
+ toolchain_type = "@rules_rust//proto:toolchain_type",
)
```
diff --git a/docs/rust_wasm_bindgen.md b/docs/rust_wasm_bindgen.md
index ae84d1d..9af8ad3 100644
--- a/docs/rust_wasm_bindgen.md
+++ b/docs/rust_wasm_bindgen.md
@@ -85,7 +85,7 @@
toolchain(
name = "wasm_bindgen_toolchain",
toolchain = "wasm_bindgen_toolchain_impl",
- toolchain_type = "@rules_rust//wasm_bindgen:wasm_bindgen_toolchain",
+ toolchain_type = "@rules_rust//wasm_bindgen:toolchain_type",
)
```
diff --git a/proto/BUILD.bazel b/proto/BUILD.bazel
index a76d069..92e3142 100644
--- a/proto/BUILD.bazel
+++ b/proto/BUILD.bazel
@@ -29,7 +29,16 @@
visibility = ["//:__subpackages__"],
)
-toolchain_type(name = "toolchain")
+toolchain_type(
+ name = "toolchain_type",
+)
+
+alias(
+ name = "toolchain",
+ actual = "toolchain_type",
+ deprecation = "instead use `@rules_rust//proto:toolchain_type`",
+ tags = ["manual"],
+)
rust_binary(
name = "optional_output_wrapper",
@@ -41,7 +50,7 @@
toolchain(
name = "default-proto-toolchain",
toolchain = ":default-proto-toolchain-impl",
- toolchain_type = "@rules_rust//proto:toolchain",
+ toolchain_type = "@rules_rust//proto:toolchain_type",
)
rust_proto_toolchain(
diff --git a/proto/proto.bzl b/proto/proto.bzl
index ea239b0..9cb83f3 100644
--- a/proto/proto.bzl
+++ b/proto/proto.bzl
@@ -186,7 +186,7 @@
"""
# Create all the source in a specific folder
- proto_toolchain = ctx.toolchains[Label("//proto:toolchain")]
+ proto_toolchain = ctx.toolchains[Label("//proto:toolchain_type")]
output_dir = "%s.%s.rust" % (crate_name, "grpc" if is_grpc else "proto")
# Generate the proto stubs
@@ -319,8 +319,8 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//proto:toolchain")),
- str(Label("//rust:toolchain")),
+ str(Label("//proto:toolchain_type")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
# TODO: Remove once (bazelbuild/bazel#11584) is closed and the rules use
@@ -397,8 +397,8 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//proto:toolchain")),
- str(Label("//rust:toolchain")),
+ str(Label("//proto:toolchain_type")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
# TODO: Remove once (bazelbuild/bazel#11584) is closed and the rules use
diff --git a/rust/BUILD.bazel b/rust/BUILD.bazel
index 672f228..f9c7368 100644
--- a/rust/BUILD.bazel
+++ b/rust/BUILD.bazel
@@ -10,7 +10,14 @@
])
toolchain_type(
+ name = "toolchain_type",
+)
+
+alias(
name = "toolchain",
+ actual = "toolchain_type",
+ deprecation = "instead use `@rules_rust//rust:toolchain_type`",
+ tags = ["manual"],
)
bzl_library(
diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl
index ec94ae7..21f3965 100644
--- a/rust/private/clippy.bzl
+++ b/rust/private/clippy.bzl
@@ -226,7 +226,7 @@
},
provides = [ClippyInfo],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
index 1c84312..f50303e 100644
--- a/rust/private/rust.bzl
+++ b/rust/private/rust.bzl
@@ -759,7 +759,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -835,7 +835,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -858,7 +858,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -910,7 +910,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -961,7 +961,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -1089,7 +1089,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -1102,7 +1102,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
@@ -1118,7 +1118,7 @@
host_fragments = ["cpp"],
test = True,
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
diff --git a/rust/private/rust_analyzer.bzl b/rust/private/rust_analyzer.bzl
index 48582b3..7515fd7 100644
--- a/rust/private/rust_analyzer.bzl
+++ b/rust/private/rust_analyzer.bzl
@@ -129,7 +129,7 @@
rust_analyzer_aspect = aspect(
attr_aspects = ["deps", "proc_macro_deps", "crate", "actual"],
implementation = _rust_analyzer_aspect_impl,
- toolchains = [str(Label("//rust:toolchain"))],
+ toolchains = [str(Label("//rust:toolchain_type"))],
incompatible_use_toolchain_transition = True,
doc = "Annotates rust rules with RustAnalyzerInfo later used to build a rust-project.json",
)
@@ -249,7 +249,7 @@
rust_analyzer_detect_sysroot = rule(
implementation = _rust_analyzer_detect_sysroot_impl,
toolchains = [
- "@rules_rust//rust:toolchain",
+ "@rules_rust//rust:toolchain_type",
"@rules_rust//rust/rust_analyzer:toolchain_type",
],
incompatible_use_toolchain_transition = True,
diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl
index 7da57e5..82fdd4e 100644
--- a/rust/private/rustdoc.bzl
+++ b/rust/private/rustdoc.bzl
@@ -321,7 +321,7 @@
"rust_doc_zip": "%{name}.zip",
},
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
diff --git a/rust/private/rustdoc_test.bzl b/rust/private/rustdoc_test.bzl
index 3a1124e..c2425b0 100644
--- a/rust/private/rustdoc_test.bzl
+++ b/rust/private/rustdoc_test.bzl
@@ -206,7 +206,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
diff --git a/rust/private/rustfmt.bzl b/rust/private/rustfmt.bzl
index 0de817d..db5ef43 100644
--- a/rust/private/rustfmt.bzl
+++ b/rust/private/rustfmt.bzl
@@ -138,7 +138,7 @@
fragments = ["cpp"],
host_fragments = ["cpp"],
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
],
)
diff --git a/rust/private/toolchain_utils.bzl b/rust/private/toolchain_utils.bzl
index 3d61746..13c94ac 100644
--- a/rust/private/toolchain_utils.bzl
+++ b/rust/private/toolchain_utils.bzl
@@ -1,7 +1,7 @@
"""A module defining toolchain utilities"""
def _toolchain_files_impl(ctx):
- toolchain = ctx.toolchains[str(Label("//rust:toolchain"))]
+ toolchain = ctx.toolchains[str(Label("//rust:toolchain_type"))]
runfiles = None
if ctx.attr.tool == "cargo":
@@ -73,13 +73,13 @@
),
},
toolchains = [
- str(Label("//rust:toolchain")),
+ str(Label("//rust:toolchain_type")),
],
incompatible_use_toolchain_transition = True,
)
def _current_rust_toolchain_impl(ctx):
- toolchain = ctx.toolchains[str(Label("@rules_rust//rust:toolchain"))]
+ toolchain = ctx.toolchains[str(Label("@rules_rust//rust:toolchain_type"))]
return [
toolchain,
@@ -98,7 +98,7 @@
doc = "A rule for exposing the current registered `rust_toolchain`.",
implementation = _current_rust_toolchain_impl,
toolchains = [
- str(Label("@rules_rust//rust:toolchain")),
+ str(Label("@rules_rust//rust:toolchain_type")),
],
incompatible_use_toolchain_transition = True,
)
diff --git a/rust/private/utils.bzl b/rust/private/utils.bzl
index b3e8e80..4ae5b5f 100644
--- a/rust/private/utils.bzl
+++ b/rust/private/utils.bzl
@@ -34,7 +34,7 @@
Returns:
rust_toolchain: A Rust toolchain context.
"""
- return ctx.toolchains[Label("//rust:toolchain")]
+ return ctx.toolchains[Label("//rust:toolchain_type")]
def find_cc_toolchain(ctx):
"""Extracts a CcToolchain from the current target's context
diff --git a/test/unit/consistent_crate_name/with_modified_crate_name.bzl b/test/unit/consistent_crate_name/with_modified_crate_name.bzl
index a9d2590..dee1321 100644
--- a/test/unit/consistent_crate_name/with_modified_crate_name.bzl
+++ b/test/unit/consistent_crate_name/with_modified_crate_name.bzl
@@ -9,7 +9,7 @@
load("//rust/private:rustc.bzl", "rustc_compile_action")
def _with_modified_crate_name_impl(ctx):
- toolchain = ctx.toolchains[Label("//rust:toolchain")]
+ toolchain = ctx.toolchains[Label("//rust:toolchain_type")]
crate_root = ctx.attr.src.files.to_list()[0]
output_hash = repr(hash(crate_root.path))
@@ -73,7 +73,10 @@
cfg = "exec",
),
},
- toolchains = ["@rules_rust//rust:toolchain", "@bazel_tools//tools/cpp:toolchain_type"],
+ toolchains = [
+ "@rules_rust//rust:toolchain_type",
+ "@bazel_tools//tools/cpp:toolchain_type",
+ ],
incompatible_use_toolchain_transition = True,
fragments = ["cpp"],
)
diff --git a/test/unit/force_all_deps_direct/generator.bzl b/test/unit/force_all_deps_direct/generator.bzl
index b44364f..2ca3195 100644
--- a/test/unit/force_all_deps_direct/generator.bzl
+++ b/test/unit/force_all_deps_direct/generator.bzl
@@ -26,7 +26,7 @@
mnemonic = "WriteRsFile",
)
- toolchain = ctx.toolchains[Label("//rust:toolchain")]
+ toolchain = ctx.toolchains[Label("//rust:toolchain_type")]
# Determine unique hash for this rlib
output_hash = repr(hash(rs_file.path))
@@ -88,7 +88,10 @@
cfg = "exec",
),
},
- toolchains = ["@rules_rust//rust:toolchain", "@bazel_tools//tools/cpp:toolchain_type"],
+ toolchains = [
+ "@rules_rust//rust:toolchain_type",
+ "@bazel_tools//tools/cpp:toolchain_type",
+ ],
incompatible_use_toolchain_transition = True,
fragments = ["cpp"],
)
diff --git a/test/unit/toolchain_make_variables/toolchain_make_variables_test.bzl b/test/unit/toolchain_make_variables/toolchain_make_variables_test.bzl
index b20e79e..02f6d9e 100644
--- a/test/unit/toolchain_make_variables/toolchain_make_variables_test.bzl
+++ b/test/unit/toolchain_make_variables/toolchain_make_variables_test.bzl
@@ -124,7 +124,7 @@
),
},
toolchains = [
- "@rules_rust//rust:toolchain",
+ "@rules_rust//rust:toolchain_type",
],
)
diff --git a/wasm_bindgen/BUILD.bazel b/wasm_bindgen/BUILD.bazel
index 0145d42..0e42393 100644
--- a/wasm_bindgen/BUILD.bazel
+++ b/wasm_bindgen/BUILD.bazel
@@ -3,7 +3,16 @@
package(default_visibility = ["//visibility:public"])
-toolchain_type(name = "wasm_bindgen_toolchain")
+toolchain_type(
+ name = "toolchain_type",
+)
+
+alias(
+ name = "wasm_bindgen_toolchain",
+ actual = "toolchain_type",
+ deprecation = "instead use `@rules_rust//wasm_bindgen:toolchain_type`",
+ tags = ["manual"],
+)
bzl_library(
name = "bzl_lib",
@@ -32,5 +41,5 @@
toolchain(
name = "default_wasm_bindgen_toolchain",
toolchain = "default_wasm_bindgen_toolchain_impl",
- toolchain_type = "//wasm_bindgen:wasm_bindgen_toolchain",
+ toolchain_type = "//wasm_bindgen:toolchain_type",
)
diff --git a/wasm_bindgen/wasm_bindgen.bzl b/wasm_bindgen/wasm_bindgen.bzl
index 81ba1dc..9794313 100644
--- a/wasm_bindgen/wasm_bindgen.bzl
+++ b/wasm_bindgen/wasm_bindgen.bzl
@@ -58,7 +58,7 @@
toolchain(
name = "wasm_bindgen_toolchain",
toolchain = "wasm_bindgen_toolchain_impl",
- toolchain_type = "@rules_rust//wasm_bindgen:wasm_bindgen_toolchain",
+ toolchain_type = "@rules_rust//wasm_bindgen:toolchain_type",
)
```