From c318b6c45c6fe438c9f9b991e5e5ca89d1791870 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 26 Apr 2022 09:54:17 -0700 Subject: [PATCH] Remove 'triple' field from triple struct in favor of 'str' --- cargo/cargo_bootstrap.bzl | 2 +- cargo/private/cargo_utils.bzl | 4 ++-- crate_universe/private/crates_repository.bzl | 2 +- rust/platform/triple.bzl | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cargo/cargo_bootstrap.bzl b/cargo/cargo_bootstrap.bzl index a839aad08a..3e04190082 100644 --- a/cargo/cargo_bootstrap.bzl +++ b/cargo/cargo_bootstrap.bzl @@ -204,7 +204,7 @@ def _cargo_bootstrap_repository_impl(repository_ctx): # In addition to platform specific environment variables, a common set (indicated by `*`) will always # be gathered. - environment = dict(_collect_environ(repository_ctx, "*").items() + _collect_environ(repository_ctx, host_triple.triple).items()) + environment = dict(_collect_environ(repository_ctx, "*").items() + _collect_environ(repository_ctx, host_triple.str).items()) built_binary = cargo_bootstrap( repository_ctx = repository_ctx, diff --git a/cargo/private/cargo_utils.bzl b/cargo/private/cargo_utils.bzl index 2aa26a3928..ef8eb288e5 100644 --- a/cargo/private/cargo_utils.bzl +++ b/cargo/private/cargo_utils.bzl @@ -66,7 +66,7 @@ def get_rust_tools(cargo_template, rustc_template, host_triple, version): cargo_label = Label(_resolve_repository_template( template = cargo_template, version = version, - triple = host_triple.triple, + triple = host_triple.str, arch = host_triple.arch, vendor = host_triple.vendor, system = host_triple.system, @@ -77,7 +77,7 @@ def get_rust_tools(cargo_template, rustc_template, host_triple, version): rustc_label = Label(_resolve_repository_template( template = rustc_template, version = version, - triple = host_triple.triple, + triple = host_triple.str, arch = host_triple.arch, vendor = host_triple.vendor, system = host_triple.system, diff --git a/crate_universe/private/crates_repository.bzl b/crate_universe/private/crates_repository.bzl index a6ebb954ee..c1325b7060 100644 --- a/crate_universe/private/crates_repository.bzl +++ b/crate_universe/private/crates_repository.bzl @@ -25,7 +25,7 @@ def _crates_repository_impl(repository_ctx): host_triple = get_host_triple(repository_ctx) # Locate the generator to use - generator, generator_sha256 = get_generator(repository_ctx, host_triple.triple) + generator, generator_sha256 = get_generator(repository_ctx, host_triple.str) # Generate a config file for all settings config_path = generate_config(repository_ctx) diff --git a/rust/platform/triple.bzl b/rust/platform/triple.bzl index 13a335911c..2c42704084 100644 --- a/rust/platform/triple.bzl +++ b/rust/platform/triple.bzl @@ -20,7 +20,6 @@ def triple(triple): - system (str): The name of the system - abi (str, optional): The abi to use or None if abi does not apply. - str (str): Original string representation of the triple - - triple (str): Deprecated; same as str """ if triple == "wasm32-wasi": return struct( @@ -29,7 +28,6 @@ def triple(triple): vendor = "wasi", abi = None, str = triple, - triple = triple, ) component_parts = triple.split("-") @@ -54,7 +52,6 @@ def triple(triple): system = system, abi = abi, str = triple, - triple = triple, ) _CPU_ARCH_ERROR_MSG = """\