Migrate rules_rust for incompatible_use_platforms_repo_for_constraints
bazelbuild/bazel#8622
diff --git a/docs/index.md b/docs/index.md
index 330d779..67fbebf 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -745,10 +745,10 @@
toolchain(
name="rust_proto",
exec_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
target_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
toolchain = ":rust_proto_impl",
)
@@ -1125,10 +1125,10 @@
toolchain(
name = "rust_cpuX",
exec_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
target_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
toolchain = ":rust_cpuX_impl",
)
diff --git a/proto/toolchain.bzl b/proto/toolchain.bzl
index 5113505..1dda7c1 100644
--- a/proto/toolchain.bzl
+++ b/proto/toolchain.bzl
@@ -177,10 +177,10 @@
toolchain(
name="rust_proto",
exec_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
target_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
toolchain = ":rust_proto_impl",
)
diff --git a/rust/platform/platform.bzl b/rust/platform/platform.bzl
index 69a657c..98a90ad 100644
--- a/rust/platform/platform.bzl
+++ b/rust/platform/platform.bzl
@@ -14,13 +14,13 @@
"x86_64-pc-windows-gnu",
"x86_64-unknown-linux-gnu",
# N.B. These "alternative" envs are not supported, as bazel cannot distinguish between them
- # and others using existing @bazel_tools//platforms config_values
+ # and others using existing @platforms// config_values
#
#"i686-pc-windows-msvc",
#"x86_64-pc-windows-msvc",
]
-# Some T2 Platforms are supported, provided we have mappings to @bazel_tools//platforms entries.
+# Some T2 Platforms are supported, provided we have mappings to @platforms// entries.
# See @io_bazel_rules_rust//rust/platform:triple_mappings.bzl for the complete list.
_SUPPORTED_T2_PLATFORM_TRIPLES = [
"aarch64-apple-ios",
diff --git a/rust/platform/triple_mappings.bzl b/rust/platform/triple_mappings.bzl
index 37fc97b..82508a9 100644
--- a/rust/platform/triple_mappings.bzl
+++ b/rust/platform/triple_mappings.bzl
@@ -1,4 +1,4 @@
-# CPUs that map to a "@bazel_tools//platforms entry
+# CPUs that map to a "@platforms//cpu entry
_CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = {
"x86_64": "x86_64",
"powerpc": "ppc",
@@ -19,7 +19,7 @@
"mipsel": None,
}
-# Systems that map to a "@bazel_tools//platforms entry
+# Systems that map to a "@platforms//os entry
_SYSTEM_TO_BUILTIN_SYS_SUFFIX = {
"freebsd": "freebsd",
"linux": "linux",
@@ -72,7 +72,7 @@
if not plat_suffix:
fail("CPU architecture \"{}\" is not supported by rules_rust".format(cpu_arch))
- return ["@bazel_tools//platforms:{}".format(plat_suffix)]
+ return ["@platforms//cpu:{}".format(plat_suffix)]
def vendor_to_constraints(vendor):
# TODO(acmcarther): Review:
@@ -87,7 +87,7 @@
if not sys_suffix:
fail("System \"{}\" is not supported by rules_rust".format(sys_suffix))
- return ["@bazel_tools//platforms:{}".format(sys_suffix)]
+ return ["@platforms//os:{}".format(sys_suffix)]
def abi_to_constraints(abi):
# TODO(acmcarther): Implement when C++ toolchain is more mature and we
diff --git a/rust/toolchain.bzl b/rust/toolchain.bzl
index 1462856..5279233 100644
--- a/rust/toolchain.bzl
+++ b/rust/toolchain.bzl
@@ -96,10 +96,10 @@
toolchain(
name = "rust_cpuX",
exec_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
target_compatible_with = [
- "@bazel_tools//platforms:cpuX",
+ "@platforms//cpu:cpuX",
],
toolchain = ":rust_cpuX_impl",
)