diff --git a/crate_universe/3rdparty/crates/BUILD.bazel b/crate_universe/3rdparty/crates/BUILD.bazel index c36b4d49c1..b7608b617d 100644 --- a/crate_universe/3rdparty/crates/BUILD.bazel +++ b/crate_universe/3rdparty/crates/BUILD.bazel @@ -69,7 +69,7 @@ alias( alias( name = "cfg-expr", - actual = "@cui__cfg-expr-0.15.5//:cfg_expr", + actual = "@cui__cfg-expr-0.17.0//:cfg_expr", tags = ["manual"], ) diff --git a/crate_universe/3rdparty/crates/BUILD.cfg-expr-0.15.5.bazel b/crate_universe/3rdparty/crates/BUILD.cfg-expr-0.17.0.bazel similarity index 99% rename from crate_universe/3rdparty/crates/BUILD.cfg-expr-0.15.5.bazel rename to crate_universe/3rdparty/crates/BUILD.cfg-expr-0.17.0.bazel index 66dcc85aea..86d6a490b6 100644 --- a/crate_universe/3rdparty/crates/BUILD.cfg-expr-0.15.5.bazel +++ b/crate_universe/3rdparty/crates/BUILD.cfg-expr-0.17.0.bazel @@ -80,7 +80,7 @@ rust_library( "@rules_rust//rust/platform:x86_64-unknown-none": [], "//conditions:default": ["@platforms//:incompatible"], }), - version = "0.15.5", + version = "0.17.0", deps = [ "@cui__smallvec-1.11.0//:smallvec", ], diff --git a/crate_universe/3rdparty/crates/defs.bzl b/crate_universe/3rdparty/crates/defs.bzl index 276d521834..ac15214b31 100644 --- a/crate_universe/3rdparty/crates/defs.bzl +++ b/crate_universe/3rdparty/crates/defs.bzl @@ -301,7 +301,7 @@ _NORMAL_DEPENDENCIES = { "cargo-platform": Label("@cui__cargo-platform-0.1.4//:cargo_platform"), "cargo_metadata": Label("@cui__cargo_metadata-0.18.1//:cargo_metadata"), "cargo_toml": Label("@cui__cargo_toml-0.19.2//:cargo_toml"), - "cfg-expr": Label("@cui__cfg-expr-0.15.5//:cfg_expr"), + "cfg-expr": Label("@cui__cfg-expr-0.17.0//:cfg_expr"), "clap": Label("@cui__clap-4.3.11//:clap"), "crates-index": Label("@cui__crates-index-2.2.0//:crates_index"), "hex": Label("@cui__hex-0.4.3//:hex"), @@ -801,12 +801,12 @@ def crate_repositories(): maybe( http_archive, - name = "cui__cfg-expr-0.15.5", - sha256 = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3", + name = "cui__cfg-expr-0.17.0", + sha256 = "d0890061c4d3223e7267f3bad2ec40b997d64faac1c2815a4a9d95018e2b9e9c", type = "tar.gz", - urls = ["https://static.crates.io/crates/cfg-expr/0.15.5/download"], - strip_prefix = "cfg-expr-0.15.5", - build_file = Label("@rules_rust//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.15.5.bazel"), + urls = ["https://static.crates.io/crates/cfg-expr/0.17.0/download"], + strip_prefix = "cfg-expr-0.17.0", + build_file = Label("@rules_rust//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.17.0.bazel"), ) maybe( @@ -3366,7 +3366,7 @@ def crate_repositories(): struct(repo = "cui__cargo-platform-0.1.4", is_dev_dep = False), struct(repo = "cui__cargo_metadata-0.18.1", is_dev_dep = False), struct(repo = "cui__cargo_toml-0.19.2", is_dev_dep = False), - struct(repo = "cui__cfg-expr-0.15.5", is_dev_dep = False), + struct(repo = "cui__cfg-expr-0.17.0", is_dev_dep = False), struct(repo = "cui__clap-4.3.11", is_dev_dep = False), struct(repo = "cui__crates-index-2.2.0", is_dev_dep = False), struct(repo = "cui__hex-0.4.3", is_dev_dep = False), diff --git a/crate_universe/Cargo.lock b/crate_universe/Cargo.lock index be8c57036c..fcfe5e0cc2 100644 --- a/crate_universe/Cargo.lock +++ b/crate_universe/Cargo.lock @@ -257,9 +257,9 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-expr" -version = "0.15.5" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +checksum = "d0890061c4d3223e7267f3bad2ec40b997d64faac1c2815a4a9d95018e2b9e9c" dependencies = [ "smallvec", ] diff --git a/crate_universe/Cargo.toml b/crate_universe/Cargo.toml index 44035477a1..56de7a23e1 100644 --- a/crate_universe/Cargo.toml +++ b/crate_universe/Cargo.toml @@ -26,7 +26,7 @@ cargo_metadata = "0.18.1" cargo_toml = "0.19.2" cargo-lock = "9.0.0" cargo-platform = "0.1.4" -cfg-expr = "0.15.5" +cfg-expr = "0.17.0" clap = { version = "4.3.11", features = ["derive", "env"] } crates-index = { version = "2.2.0", default-features = false, features = [ "git", diff --git a/rust/platform/cpu/BUILD.bazel b/rust/platform/cpu/BUILD.bazel deleted file mode 100644 index 2618a448be..0000000000 --- a/rust/platform/cpu/BUILD.bazel +++ /dev/null @@ -1,6 +0,0 @@ -alias( - name = "wasm32", - actual = "@platforms//cpu:wasm32", - deprecation = "Use @platforms//cpu:wasm32 directly instead.", - visibility = ["//visibility:public"], -) diff --git a/rust/platform/platform.bzl b/rust/platform/platform.bzl index 3727d342a8..22854ba058 100644 --- a/rust/platform/platform.bzl +++ b/rust/platform/platform.bzl @@ -3,7 +3,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects") load( ":triple_mappings.bzl", - "SUPPORTED_PLATFORM_TRIPLES", + "ALL_PLATFORM_TRIPLES", "cpu_arch_to_constraints", "system_to_constraints", "triple_to_constraint_set", @@ -59,7 +59,7 @@ def declare_config_settings(): actual = ":darwin", ) - all_supported_triples = SUPPORTED_PLATFORM_TRIPLES + all_supported_triples = ALL_PLATFORM_TRIPLES for triple in all_supported_triples: native.config_setting( name = triple, diff --git a/rust/platform/triple_mappings.bzl b/rust/platform/triple_mappings.bzl index 3ab6f6ddf6..a0bf91c77d 100644 --- a/rust/platform/triple_mappings.bzl +++ b/rust/platform/triple_mappings.bzl @@ -2,65 +2,101 @@ load("//rust/platform:triple.bzl", "triple") +def _support(*, std = False, host_tools = False): + """Identify the type of support an associated platform triple has. + + The source of truth is: + https://doc.rust-lang.org/nightly/rustc/platform-support.html + + Args: + std (bool, optional): Whether or not platform has a standard library artifact. + host_tools (bool, optional): Whether or not platform has host tools artifacts. + + Returns: + struct: The parameters above. + """ + return struct( + std = std, + host_tools = host_tools, + ) + # All T1 Platforms should be supported, but aren't, see inline notes. -SUPPORTED_T1_PLATFORM_TRIPLES = [ - "aarch64-unknown-linux-gnu", - "aarch64-unknown-nixos-gnu", # Same as `aarch64-unknown-linux-gnu` but with `@platforms//os:nixos`. - "i686-apple-darwin", - "i686-pc-windows-msvc", - "i686-unknown-linux-gnu", - "x86_64-apple-darwin", - "x86_64-pc-windows-msvc", - "x86_64-unknown-linux-gnu", - "x86_64-unknown-nixos-gnu", # Same as `x86_64-unknown-linux-gnu` but with `@platforms//os:nixos`. +SUPPORTED_T1_PLATFORM_TRIPLES = { + "aarch64-apple-darwin": _support(std = True, host_tools = True), + "aarch64-unknown-linux-gnu": _support(std = True, host_tools = True), + "aarch64-unknown-nixos-gnu": _support(std = True, host_tools = True), # Same as `aarch64-unknown-linux-gnu` but with `@platforms//os:nixos`. + "i686-apple-darwin": _support(std = True, host_tools = True), + "i686-pc-windows-msvc": _support(std = True, host_tools = True), + "i686-unknown-linux-gnu": _support(std = True, host_tools = True), + "x86_64-apple-darwin": _support(std = True, host_tools = True), + "x86_64-pc-windows-msvc": _support(std = True, host_tools = True), + "x86_64-unknown-linux-gnu": _support(std = True, host_tools = True), + "x86_64-unknown-nixos-gnu": _support(std = True, host_tools = True), # Same as `x86_64-unknown-linux-gnu` but with `@platforms//os:nixos`. # N.B. These "alternative" envs are not supported, as bazel cannot distinguish between them # and others using existing @platforms// config_values # #"i686-pc-windows-gnu", #"x86_64-pc-windows-gnu", -] - -# Some T2 Platforms are supported, provided we have mappings to @platforms// entries. -# See @rules_rust//rust/platform:triple_mappings.bzl for the complete list. -SUPPORTED_T2_PLATFORM_TRIPLES = [ - "aarch64-apple-darwin", - "aarch64-apple-ios-sim", - "aarch64-apple-ios", - "aarch64-fuchsia", - "aarch64-linux-android", - "aarch64-pc-windows-msvc", - "arm-unknown-linux-gnueabi", - "armv7-linux-androideabi", - "armv7-unknown-linux-gnueabi", - "i686-linux-android", - "i686-unknown-freebsd", - "powerpc-unknown-linux-gnu", - "riscv32imc-unknown-none-elf", - "riscv64gc-unknown-none-elf", - "s390x-unknown-linux-gnu", - "thumbv7em-none-eabi", - "thumbv8m.main-none-eabi", - "wasm32-unknown-unknown", - "wasm32-wasi", - "x86_64-apple-ios", - "x86_64-fuchsia", - "x86_64-linux-android", - "x86_64-unknown-freebsd", - "x86_64-unknown-none", -] - -# Note that only platforms with `std` artifacts should be added -# to this list: https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3 -SUPPORTED_T3_PLATFORM_TRIPLES = [ - "aarch64-unknown-nto-qnx710", -] - -SUPPORTED_PLATFORM_TRIPLES = SUPPORTED_T1_PLATFORM_TRIPLES + SUPPORTED_T2_PLATFORM_TRIPLES + SUPPORTED_T3_PLATFORM_TRIPLES - -# CPUs that map to a "@platforms//cpu entry +} + +# Some T2 Platforms are supported, provided we have mappings to `@platforms//...` entries. +# See `@rules_rust//rust/platform:triple_mappings.bzl` for the complete list. +SUPPORTED_T2_PLATFORM_TRIPLES = { + "aarch64-apple-ios": _support(std = True, host_tools = False), + "aarch64-apple-ios-sim": _support(std = True, host_tools = False), + "aarch64-fuchsia": _support(std = True, host_tools = False), + "aarch64-linux-android": _support(std = True, host_tools = False), + "aarch64-pc-windows-msvc": _support(std = True, host_tools = True), + "arm-unknown-linux-gnueabi": _support(std = True, host_tools = True), + "armv7-linux-androideabi": _support(std = True, host_tools = False), + "armv7-unknown-linux-gnueabi": _support(std = True, host_tools = True), + "i686-linux-android": _support(std = True, host_tools = False), + "i686-unknown-freebsd": _support(std = True, host_tools = False), + "powerpc-unknown-linux-gnu": _support(std = True, host_tools = True), + "riscv32imc-unknown-none-elf": _support(std = True, host_tools = False), + "riscv64gc-unknown-none-elf": _support(std = True, host_tools = False), + "s390x-unknown-linux-gnu": _support(std = True, host_tools = True), + "thumbv7em-none-eabi": _support(std = True, host_tools = False), + "thumbv8m.main-none-eabi": _support(std = True, host_tools = False), + "wasm32-unknown-unknown": _support(std = True, host_tools = False), + "wasm32-wasi": _support(std = True, host_tools = False), + "x86_64-apple-ios": _support(std = True, host_tools = False), + "x86_64-fuchsia": _support(std = True, host_tools = False), + "x86_64-linux-android": _support(std = True, host_tools = False), + "x86_64-unknown-freebsd": _support(std = True, host_tools = True), + "x86_64-unknown-none": _support(std = True, host_tools = False), +} + +_T3_PLATFORM_TRIPLES = { + "aarch64-unknown-nto-qnx710": _support(std = True, host_tools = False), + "wasm64-unknown-unknown": _support(std = False, host_tools = False), +} + +# The only T3 triples that are supported are ones with at least a stdlib +# artifact. However, it can be useful to know of additional triples so +# this list exists separate from the full list above. +SUPPORTED_T3_PLATFORM_TRIPLES = { + triple: support + for triple, support in _T3_PLATFORM_TRIPLES.items() + if support.std +} + +SUPPORTED_PLATFORM_TRIPLES = sorted( + SUPPORTED_T1_PLATFORM_TRIPLES.keys() + SUPPORTED_T2_PLATFORM_TRIPLES.keys() + SUPPORTED_T3_PLATFORM_TRIPLES.keys(), +) + +# Represents all platform triples `rules_rust` is configured to handle in some way. +# Note that with T3 platforms some artifacts may not be available which can lead to +# failures in the analysis phase. This list should be used sparingly. +ALL_PLATFORM_TRIPLES = sorted( + SUPPORTED_T1_PLATFORM_TRIPLES.keys() + SUPPORTED_T2_PLATFORM_TRIPLES.keys() + _T3_PLATFORM_TRIPLES.keys(), +) + +# CPUs that map to a `@platforms//cpu` entry _CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = { "aarch64": "aarch64", "arm": "arm", + "arm64e": "arm64e", "armv7": "armv7", "armv7s": None, "asmjs": None, @@ -83,8 +119,8 @@ _CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = { "thumbv7em": "armv7e-m", "thumbv7m": "armv7-m", "thumbv8m.main": "armv8-m", - "wasm32": None, - "wasm64": None, + "wasm32": "wasm32", + "wasm64": "wasm64", "x86_64": "x86_64", }