From 021fcbd90cebe83bb2f0298f2e7001605b5a97d7 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 5 Oct 2020 15:37:55 +0300 Subject: [PATCH 1/2] rustc_target: Refactor away `TargetResult` Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary. --- .../rustc_target/src/spec/aarch64_apple_darwin.rs | 8 ++++---- .../rustc_target/src/spec/aarch64_apple_ios.rs | 8 ++++---- .../rustc_target/src/spec/aarch64_apple_tvos.rs | 8 ++++---- compiler/rustc_target/src/spec/aarch64_fuchsia.rs | 8 ++++---- .../src/spec/aarch64_linux_android.rs | 8 ++++---- .../src/spec/aarch64_pc_windows_msvc.rs | 8 ++++---- .../src/spec/aarch64_unknown_cloudabi.rs | 8 ++++---- .../src/spec/aarch64_unknown_freebsd.rs | 8 ++++---- .../src/spec/aarch64_unknown_hermit.rs | 8 ++++---- .../src/spec/aarch64_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/aarch64_unknown_linux_musl.rs | 8 ++++---- .../src/spec/aarch64_unknown_netbsd.rs | 8 ++++---- .../rustc_target/src/spec/aarch64_unknown_none.rs | 6 +++--- .../src/spec/aarch64_unknown_none_softfloat.rs | 6 +++--- .../src/spec/aarch64_unknown_openbsd.rs | 8 ++++---- .../src/spec/aarch64_unknown_redox.rs | 8 ++++---- .../src/spec/aarch64_uwp_windows_msvc.rs | 8 ++++---- .../rustc_target/src/spec/aarch64_wrs_vxworks.rs | 8 ++++---- .../src/spec/arm_linux_androideabi.rs | 8 ++++---- .../src/spec/arm_unknown_linux_gnueabi.rs | 8 ++++---- .../src/spec/arm_unknown_linux_gnueabihf.rs | 8 ++++---- .../src/spec/arm_unknown_linux_musleabi.rs | 8 ++++---- .../src/spec/arm_unknown_linux_musleabihf.rs | 8 ++++---- .../rustc_target/src/spec/armebv7r_none_eabi.rs | 8 ++++---- .../rustc_target/src/spec/armebv7r_none_eabihf.rs | 8 ++++---- .../src/spec/armv4t_unknown_linux_gnueabi.rs | 8 ++++---- .../src/spec/armv5te_unknown_linux_gnueabi.rs | 8 ++++---- .../src/spec/armv5te_unknown_linux_musleabi.rs | 8 ++++---- .../src/spec/armv6_unknown_freebsd.rs | 8 ++++---- .../src/spec/armv6_unknown_netbsd_eabihf.rs | 8 ++++---- compiler/rustc_target/src/spec/armv7_apple_ios.rs | 8 ++++---- .../src/spec/armv7_linux_androideabi.rs | 8 ++++---- .../src/spec/armv7_unknown_cloudabi_eabihf.rs | 8 ++++---- .../src/spec/armv7_unknown_freebsd.rs | 8 ++++---- .../src/spec/armv7_unknown_linux_gnueabi.rs | 8 ++++---- .../src/spec/armv7_unknown_linux_gnueabihf.rs | 8 ++++---- .../src/spec/armv7_unknown_linux_musleabi.rs | 8 ++++---- .../src/spec/armv7_unknown_linux_musleabihf.rs | 8 ++++---- .../src/spec/armv7_unknown_netbsd_eabihf.rs | 8 ++++---- .../src/spec/armv7_wrs_vxworks_eabihf.rs | 8 ++++---- .../rustc_target/src/spec/armv7a_none_eabi.rs | 6 +++--- .../rustc_target/src/spec/armv7a_none_eabihf.rs | 6 +++--- .../rustc_target/src/spec/armv7r_none_eabi.rs | 8 ++++---- .../rustc_target/src/spec/armv7r_none_eabihf.rs | 8 ++++---- .../rustc_target/src/spec/armv7s_apple_ios.rs | 8 ++++---- .../src/spec/asmjs_unknown_emscripten.rs | 6 +++--- compiler/rustc_target/src/spec/avr_gnu_base.rs | 8 ++++---- .../src/spec/avr_unknown_gnu_atmega328.rs | 4 ++-- .../src/spec/hexagon_unknown_linux_musl.rs | 8 ++++---- compiler/rustc_target/src/spec/i386_apple_ios.rs | 8 ++++---- .../rustc_target/src/spec/i586_pc_windows_msvc.rs | 8 ++++---- .../src/spec/i586_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/i586_unknown_linux_musl.rs | 8 ++++---- .../rustc_target/src/spec/i686_apple_darwin.rs | 8 ++++---- .../rustc_target/src/spec/i686_linux_android.rs | 8 ++++---- .../rustc_target/src/spec/i686_pc_windows_gnu.rs | 8 ++++---- .../rustc_target/src/spec/i686_pc_windows_msvc.rs | 8 ++++---- .../src/spec/i686_unknown_cloudabi.rs | 8 ++++---- .../rustc_target/src/spec/i686_unknown_freebsd.rs | 8 ++++---- .../rustc_target/src/spec/i686_unknown_haiku.rs | 8 ++++---- .../src/spec/i686_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/i686_unknown_linux_musl.rs | 8 ++++---- .../rustc_target/src/spec/i686_unknown_netbsd.rs | 8 ++++---- .../rustc_target/src/spec/i686_unknown_openbsd.rs | 8 ++++---- .../rustc_target/src/spec/i686_unknown_uefi.rs | 8 ++++---- .../rustc_target/src/spec/i686_uwp_windows_gnu.rs | 8 ++++---- .../src/spec/i686_uwp_windows_msvc.rs | 8 ++++---- .../rustc_target/src/spec/i686_wrs_vxworks.rs | 8 ++++---- .../src/spec/mips64_unknown_linux_gnuabi64.rs | 8 ++++---- .../src/spec/mips64_unknown_linux_muslabi64.rs | 8 ++++---- .../src/spec/mips64el_unknown_linux_gnuabi64.rs | 8 ++++---- .../src/spec/mips64el_unknown_linux_muslabi64.rs | 8 ++++---- .../src/spec/mips_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/mips_unknown_linux_musl.rs | 8 ++++---- .../src/spec/mips_unknown_linux_uclibc.rs | 8 ++++---- compiler/rustc_target/src/spec/mipsel_sony_psp.rs | 8 ++++---- .../src/spec/mipsel_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/mipsel_unknown_linux_musl.rs | 8 ++++---- .../src/spec/mipsel_unknown_linux_uclibc.rs | 8 ++++---- .../src/spec/mipsisa32r6_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/mipsisa32r6el_unknown_linux_gnu.rs | 8 ++++---- .../spec/mipsisa64r6_unknown_linux_gnuabi64.rs | 8 ++++---- .../spec/mipsisa64r6el_unknown_linux_gnuabi64.rs | 8 ++++---- compiler/rustc_target/src/spec/mod.rs | 6 ++---- compiler/rustc_target/src/spec/msp430_none_elf.rs | 8 ++++---- .../rustc_target/src/spec/nvptx64_nvidia_cuda.rs | 10 ++++------ .../src/spec/powerpc64_unknown_freebsd.rs | 8 ++++---- .../src/spec/powerpc64_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/powerpc64_unknown_linux_musl.rs | 8 ++++---- .../src/spec/powerpc64_wrs_vxworks.rs | 8 ++++---- .../src/spec/powerpc64le_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/powerpc64le_unknown_linux_musl.rs | 8 ++++---- .../src/spec/powerpc_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/powerpc_unknown_linux_gnuspe.rs | 8 ++++---- .../src/spec/powerpc_unknown_linux_musl.rs | 8 ++++---- .../src/spec/powerpc_unknown_netbsd.rs | 8 ++++---- .../rustc_target/src/spec/powerpc_wrs_vxworks.rs | 8 ++++---- .../src/spec/powerpc_wrs_vxworks_spe.rs | 8 ++++---- .../src/spec/riscv32gc_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/riscv32i_unknown_none_elf.rs | 8 ++++---- .../src/spec/riscv32imac_unknown_none_elf.rs | 8 ++++---- .../src/spec/riscv32imc_unknown_none_elf.rs | 8 ++++---- .../src/spec/riscv64gc_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/riscv64gc_unknown_none_elf.rs | 8 ++++---- .../src/spec/riscv64imac_unknown_none_elf.rs | 8 ++++---- .../src/spec/s390x_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/sparc64_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/sparc64_unknown_netbsd.rs | 8 ++++---- .../src/spec/sparc64_unknown_openbsd.rs | 8 ++++---- .../src/spec/sparc_unknown_linux_gnu.rs | 8 ++++---- .../rustc_target/src/spec/sparcv9_sun_solaris.rs | 8 ++++---- .../rustc_target/src/spec/tests/tests_impl.rs | 15 ++++----------- .../rustc_target/src/spec/thumbv4t_none_eabi.rs | 8 ++++---- .../rustc_target/src/spec/thumbv6m_none_eabi.rs | 8 ++++---- .../src/spec/thumbv7a_pc_windows_msvc.rs | 8 ++++---- .../src/spec/thumbv7a_uwp_windows_msvc.rs | 8 ++++---- .../rustc_target/src/spec/thumbv7em_none_eabi.rs | 8 ++++---- .../src/spec/thumbv7em_none_eabihf.rs | 8 ++++---- .../rustc_target/src/spec/thumbv7m_none_eabi.rs | 8 ++++---- .../src/spec/thumbv7neon_linux_androideabi.rs | 8 ++++---- .../spec/thumbv7neon_unknown_linux_gnueabihf.rs | 8 ++++---- .../spec/thumbv7neon_unknown_linux_musleabihf.rs | 8 ++++---- .../src/spec/thumbv8m_base_none_eabi.rs | 8 ++++---- .../src/spec/thumbv8m_main_none_eabi.rs | 8 ++++---- .../src/spec/thumbv8m_main_none_eabihf.rs | 8 ++++---- .../src/spec/wasm32_unknown_emscripten.rs | 6 +++--- .../src/spec/wasm32_unknown_unknown.rs | 6 +++--- compiler/rustc_target/src/spec/wasm32_wasi.rs | 6 +++--- .../rustc_target/src/spec/x86_64_apple_darwin.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_apple_ios.rs | 8 ++++---- .../src/spec/x86_64_apple_ios_macabi.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_apple_tvos.rs | 8 ++++---- .../src/spec/x86_64_fortanix_unknown_sgx.rs | 6 +++--- compiler/rustc_target/src/spec/x86_64_fuchsia.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_linux_android.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_linux_kernel.rs | 8 ++++---- .../src/spec/x86_64_pc_windows_gnu.rs | 8 ++++---- .../src/spec/x86_64_pc_windows_msvc.rs | 8 ++++---- .../src/spec/x86_64_rumprun_netbsd.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_sun_solaris.rs | 8 ++++---- .../src/spec/x86_64_unknown_cloudabi.rs | 8 ++++---- .../src/spec/x86_64_unknown_dragonfly.rs | 8 ++++---- .../src/spec/x86_64_unknown_freebsd.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_unknown_haiku.rs | 8 ++++---- .../src/spec/x86_64_unknown_hermit.rs | 8 ++++---- .../src/spec/x86_64_unknown_hermit_kernel.rs | 8 ++++---- .../src/spec/x86_64_unknown_illumos.rs | 8 ++++---- .../src/spec/x86_64_unknown_l4re_uclibc.rs | 8 ++++---- .../src/spec/x86_64_unknown_linux_gnu.rs | 8 ++++---- .../src/spec/x86_64_unknown_linux_gnux32.rs | 8 ++++---- .../src/spec/x86_64_unknown_linux_musl.rs | 8 ++++---- .../src/spec/x86_64_unknown_netbsd.rs | 8 ++++---- .../src/spec/x86_64_unknown_openbsd.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_unknown_redox.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_unknown_uefi.rs | 8 ++++---- .../src/spec/x86_64_uwp_windows_gnu.rs | 8 ++++---- .../src/spec/x86_64_uwp_windows_msvc.rs | 8 ++++---- .../rustc_target/src/spec/x86_64_wrs_vxworks.rs | 8 ++++---- 158 files changed, 619 insertions(+), 630 deletions(-) diff --git a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs index 60daf10b36a..b24518beae2 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_darwin.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::apple_base::opts(); base.cpu = "apple-a12".to_string(); base.max_atomic_width = Some(128); @@ -14,7 +14,7 @@ pub fn target() -> TargetResult { let arch = "aarch64"; let llvm_target = super::apple_base::macos_llvm_target(&arch); - Ok(Target { + Target { llvm_target, target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios.rs index 168cd01878e..ab20ec041ab 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_ios.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::Arm64); - Ok(Target { + Target { llvm_target: "arm64-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -33,5 +33,5 @@ pub fn target() -> TargetResult { .to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs index 5e2cab0df1e..4619197fc69 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_tvos.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::Arm64); - Ok(Target { + Target { llvm_target: "arm64-apple-tvos".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { forces_embed_bitcode: true, ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_fuchsia.rs b/compiler/rustc_target/src/spec/aarch64_fuchsia.rs index aabfe458ca3..beb2a0912e6 100644 --- a/compiler/rustc_target/src/spec/aarch64_fuchsia.rs +++ b/compiler/rustc_target/src/spec/aarch64_fuchsia.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::fuchsia_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-fuchsia".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: String::new(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_linux_android.rs b/compiler/rustc_target/src/spec/aarch64_linux_android.rs index e4ecc7ac2dc..519fd98d200 100644 --- a/compiler/rustc_target/src/spec/aarch64_linux_android.rs +++ b/compiler/rustc_target/src/spec/aarch64_linux_android.rs @@ -1,15 +1,15 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a // for target ABI requirements. -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::android_base::opts(); base.max_atomic_width = Some(128); // As documented in http://developer.android.com/ndk/guides/cpu-features.html // the neon (ASIMD) and FP must exist on all android aarch64 targets. base.features = "+neon,+fp-armv8".to_string(); - Ok(Target { + Target { llvm_target: "aarch64-linux-android".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/aarch64_pc_windows_msvc.rs index 8c03f1e8a7e..09df41d3360 100644 --- a/compiler/rustc_target/src/spec/aarch64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/aarch64_pc_windows_msvc.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); base.max_atomic_width = Some(64); base.has_elf_tls = true; base.features = "+neon,+fp-armv8".to_string(); - Ok(Target { + Target { llvm_target: "aarch64-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "pc".to_string(), linker_flavor: LinkerFlavor::Msvc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_cloudabi.rs b/compiler/rustc_target/src/spec/aarch64_unknown_cloudabi.rs index 1278b89c7fd..cecf3860fa5 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_cloudabi.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_cloudabi.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::cloudabi_base::opts(); base.max_atomic_width = Some(128); base.unsupported_abis = super::arm_base::unsupported_abis(); base.linker = Some("aarch64-unknown-cloudabi-cc".to_string()); - Ok(Target { + Target { llvm_target: "aarch64-unknown-cloudabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs index 5ae592c5139..78e9f990de2 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_freebsd.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::freebsd_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-unknown-freebsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_hermit.rs b/compiler/rustc_target/src/spec/aarch64_unknown_hermit.rs index e07b8f7a756..c0532925fb9 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_hermit.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::hermit_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-unknown-hermit".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs index 036162248c7..67ee463c178 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_gnu.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs index dc613f35d1d..cb566c84ed7 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_linux_musl.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-unknown-linux-musl".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs index 8c2f6fcff73..d6990f7430f 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_netbsd.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.max_atomic_width = Some(128); base.unsupported_abis = super::arm_base::unsupported_abis(); - Ok(Target { + Target { llvm_target: "aarch64-unknown-netbsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_none.rs b/compiler/rustc_target/src/spec/aarch64_unknown_none.rs index e012dce73fe..fd45acb332a 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_none.rs @@ -8,7 +8,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Result { +pub fn target() -> Target { let opts = TargetOptions { linker: Some("rust-lld".to_owned()), features: "+strict-align,+neon,+fp-armv8".to_string(), @@ -21,7 +21,7 @@ pub fn target() -> Result { unsupported_abis: super::arm_base::unsupported_abis(), ..Default::default() }; - Ok(Target { + Target { llvm_target: "aarch64-unknown-none".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -33,5 +33,5 @@ pub fn target() -> Result { arch: "aarch64".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: opts, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs index e2aa6e3b8f5..666f417036e 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs @@ -8,7 +8,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Result { +pub fn target() -> Target { let opts = TargetOptions { linker: Some("rust-lld".to_owned()), features: "+strict-align,-neon,-fp-armv8".to_string(), @@ -21,7 +21,7 @@ pub fn target() -> Result { unsupported_abis: super::arm_base::unsupported_abis(), ..Default::default() }; - Ok(Target { + Target { llvm_target: "aarch64-unknown-none".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -33,5 +33,5 @@ pub fn target() -> Result { arch: "aarch64".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: opts, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs index fd726c70f49..2b7dbc0ebdb 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_openbsd.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::openbsd_base::opts(); base.max_atomic_width = Some(128); base.unsupported_abis = super::arm_base::unsupported_abis(); - Ok(Target { + Target { llvm_target: "aarch64-unknown-openbsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_unknown_redox.rs b/compiler/rustc_target/src/spec/aarch64_unknown_redox.rs index f347a2dba53..5f151473e0f 100644 --- a/compiler/rustc_target/src/spec/aarch64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/aarch64_unknown_redox.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::redox_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-unknown-redox".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/aarch64_uwp_windows_msvc.rs index 6a8d148259a..7dfcc1c065f 100644 --- a/compiler/rustc_target/src/spec/aarch64_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/aarch64_uwp_windows_msvc.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_uwp_msvc_base::opts(); base.max_atomic_width = Some(64); base.has_elf_tls = true; - Ok(Target { + Target { llvm_target: "aarch64-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "uwp".to_string(), linker_flavor: LinkerFlavor::Msvc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs index 05f5d7d3a8b..fc2d192ef12 100644 --- a/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/aarch64_wrs_vxworks.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::vxworks_base::opts(); base.max_atomic_width = Some(128); - Ok(Target { + Target { llvm_target: "aarch64-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: "wrs".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/arm_linux_androideabi.rs b/compiler/rustc_target/src/spec/arm_linux_androideabi.rs index 7109d043f51..7ea00800562 100644 --- a/compiler/rustc_target/src/spec/arm_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/arm_linux_androideabi.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::android_base::opts(); // https://developer.android.com/ndk/guides/abis.html#armeabi base.features = "+strict-align,+v5te".to_string(); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "arm-linux-androideabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs index 2e3bad83e25..0573cf5ba9d 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabi.rs @@ -1,9 +1,9 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "arm-unknown-linux-gnueabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs index f8e357cce66..dbd68e366a1 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_gnueabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "arm-unknown-linux-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs index 75753af9f30..cd5c181ec61 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabi.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); // Most of these settings are copied from the arm_unknown_linux_gnueabi // target. base.features = "+strict-align,+v6".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // to determine the calling convention and float ABI, and it doesn't // support the "musleabi" value. @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs index c74c88e3612..2b99cd01e59 100644 --- a/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/arm_unknown_linux_musleabihf.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); // Most of these settings are copied from the arm_unknown_linux_gnueabihf // target. base.features = "+strict-align,+v6,+vfp2,-d32".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and it // doesn't support the "musleabihf" value. @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs index e0d1f2653ce..c414810dab2 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs @@ -1,10 +1,10 @@ // Targets the Big endian Cortex-R4/R5 processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "armebv7r-unknown-none-eabi".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { emit_debug_gdb_scripts: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs index e2d37d45bf1..608095db197 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs @@ -1,10 +1,10 @@ // Targets the Cortex-R4F/R5F processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "armebv7r-unknown-none-eabihf".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -27,5 +27,5 @@ pub fn target() -> TargetResult { emit_debug_gdb_scripts: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs index 2580e8b0f85..74a08454621 100644 --- a/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/armv4t_unknown_linux_gnueabi.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_base::opts(); - Ok(Target { + Target { llvm_target: "armv4t-unknown-linux-gnueabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs index f28421dc775..08bd221bcc8 100644 --- a/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/armv5te_unknown_linux_gnueabi.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_base::opts(); - Ok(Target { + Target { llvm_target: "armv5te-unknown-linux-gnueabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs index fe1fa88883d..bb8ed6d1d9d 100644 --- a/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/armv5te_unknown_linux_musleabi.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_musl_base::opts(); - Ok(Target { + Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM // doesn't support the "musleabihf" value. @@ -25,5 +25,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs index 1e06f837997..902dac30b51 100644 --- a/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/armv6_unknown_freebsd.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::freebsd_base::opts(); - Ok(Target { + Target { llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs index ef40085888c..7f611defe90 100644 --- a/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv6_unknown_netbsd_eabihf.rs @@ -1,9 +1,9 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_apple_ios.rs b/compiler/rustc_target/src/spec/armv7_apple_ios.rs index 6dafcc2c345..ac24e872a9a 100644 --- a/compiler/rustc_target/src/spec/armv7_apple_ios.rs +++ b/compiler/rustc_target/src/spec/armv7_apple_ios.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::Armv7); - Ok(Target { + Target { llvm_target: "armv7-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs index 38c6c31bd10..ebaef615ac3 100644 --- a/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/armv7_linux_androideabi.rs @@ -1,4 +1,4 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target if is for the baseline of the Android v7a ABI // in thumb mode. It's named armv7-* instead of thumbv7-* @@ -8,13 +8,13 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; // See https://developer.android.com/ndk/guides/abis.html#v7a // for target ABI requirements. -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::android_base::opts(); base.features = "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string()); - Ok(Target { + Target { llvm_target: "armv7-none-linux-android".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_cloudabi_eabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_cloudabi_eabihf.rs index e3f4fe0b2ef..5a1391ccedd 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_cloudabi_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_cloudabi_eabihf.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::cloudabi_base::opts(); base.cpu = "cortex-a8".to_string(); base.max_atomic_width = Some(64); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { base.unsupported_abis = super::arm_base::unsupported_abis(); base.linker = Some("armv7-unknown-cloudabi-eabihf-cc".to_string()); - Ok(Target { + Target { llvm_target: "armv7-unknown-cloudabi-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs index 80a9e6d7e3c..08d7d268148 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_freebsd.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::freebsd_base::opts(); - Ok(Target { + Target { llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs index 0f175e9aef5..02abd02f3b2 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabi.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target is for glibc Linux on ARMv7 without thumb-mode, NEON or // hardfloat. -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_base::opts(); - Ok(Target { + Target { llvm_target: "armv7-unknown-linux-gnueabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -25,5 +25,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs index 27923457cd1..d63c728fe4b 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target is for glibc Linux on ARMv7 without NEON or // thumb-mode. See the thumbv7neon variant for enabling both. -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_base::opts(); - Ok(Target { + Target { llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs index 3d1bf05237f..93a004fa002 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabi.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target is for musl Linux on ARMv7 without thumb-mode, NEON or // hardfloat. -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_musl_base::opts(); // Most of these settings are copied from the armv7_unknown_linux_gnueabi // target. - Ok(Target { + Target { // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it // to determine the calling convention and float ABI, and it doesn't // support the "musleabi" value. @@ -30,5 +30,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs index 03d7d88b0d6..93a87ff44ef 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_linux_musleabihf.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target is for musl Linux on ARMv7 without thumb-mode or NEON. -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_musl_base::opts(); - Ok(Target { + Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM // doesn't support the "musleabihf" value. @@ -29,5 +29,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs index 18fc9ed2ec6..c3a2324130c 100644 --- a/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_unknown_netbsd_eabihf.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::netbsd_base::opts(); - Ok(Target { + Target { llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs index 04d8702471a..4d95a279218 100644 --- a/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_wrs_vxworks_eabihf.rs @@ -1,8 +1,8 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::vxworks_base::opts(); - Ok(Target { + Target { llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7a_none_eabi.rs b/compiler/rustc_target/src/spec/armv7a_none_eabi.rs index 1db279defff..dfd60601f4d 100644 --- a/compiler/rustc_target/src/spec/armv7a_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv7a_none_eabi.rs @@ -19,7 +19,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Result { +pub fn target() -> Target { let opts = TargetOptions { linker: Some("rust-lld".to_owned()), features: "+v7,+thumb2,+soft-float,-neon,+strict-align".to_string(), @@ -32,7 +32,7 @@ pub fn target() -> Result { emit_debug_gdb_scripts: false, ..Default::default() }; - Ok(Target { + Target { llvm_target: "armv7a-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -44,5 +44,5 @@ pub fn target() -> Result { arch: "arm".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: opts, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs index 22c2b306b43..340d9788d23 100644 --- a/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7a_none_eabihf.rs @@ -7,7 +7,7 @@ use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> Result { +pub fn target() -> Target { let opts = TargetOptions { linker: Some("rust-lld".to_owned()), features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".to_string(), @@ -20,7 +20,7 @@ pub fn target() -> Result { emit_debug_gdb_scripts: false, ..Default::default() }; - Ok(Target { + Target { llvm_target: "armv7a-none-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -32,5 +32,5 @@ pub fn target() -> Result { arch: "arm".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: opts, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs index fed83997190..a3994e72490 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs @@ -1,10 +1,10 @@ // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "armv7r-unknown-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { emit_debug_gdb_scripts: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs index 769ac13e515..3248679dc45 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs @@ -1,10 +1,10 @@ // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "armv7r-unknown-none-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -27,5 +27,5 @@ pub fn target() -> TargetResult { emit_debug_gdb_scripts: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/armv7s_apple_ios.rs index d6c99c4ade6..54f1b1a2ac2 100644 --- a/compiler/rustc_target/src/spec/armv7s_apple_ios.rs +++ b/compiler/rustc_target/src/spec/armv7s_apple_ios.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::Armv7s); - Ok(Target { + Target { llvm_target: "armv7s-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs b/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs index d3dbc39c99d..1c3f5c4f9e8 100644 --- a/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/asmjs_unknown_emscripten.rs @@ -1,12 +1,12 @@ use super::{wasm32_unknown_emscripten, LinkerFlavor, Target}; -pub fn target() -> Result { - let mut target = wasm32_unknown_emscripten::target()?; +pub fn target() -> Target { + let mut target = wasm32_unknown_emscripten::target(); target .options .post_link_args .entry(LinkerFlavor::Em) .or_default() .extend(vec!["-s".to_string(), "WASM=0".to_string()]); - Ok(target) + target } diff --git a/compiler/rustc_target/src/spec/avr_gnu_base.rs b/compiler/rustc_target/src/spec/avr_gnu_base.rs index 527a322d56a..83a048b06ba 100644 --- a/compiler/rustc_target/src/spec/avr_gnu_base.rs +++ b/compiler/rustc_target/src/spec/avr_gnu_base.rs @@ -1,10 +1,10 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; /// A base target for AVR devices using the GNU toolchain. /// /// Requires GNU avr-gcc and avr-binutils on the host system. -pub fn target(target_cpu: String) -> TargetResult { - Ok(Target { +pub fn target(target_cpu: String) -> Target { + Target { arch: "avr".to_string(), data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(), llvm_target: "avr-unknown-unknown".to_string(), @@ -49,5 +49,5 @@ pub fn target(target_cpu: String) -> TargetResult { atomic_cas: false, ..TargetOptions::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/avr_unknown_gnu_atmega328.rs b/compiler/rustc_target/src/spec/avr_unknown_gnu_atmega328.rs index 5d22598b57b..7e63ae9c5aa 100644 --- a/compiler/rustc_target/src/spec/avr_unknown_gnu_atmega328.rs +++ b/compiler/rustc_target/src/spec/avr_unknown_gnu_atmega328.rs @@ -1,5 +1,5 @@ -use crate::spec::TargetResult; +use crate::spec::Target; -pub fn target() -> TargetResult { +pub fn target() -> Target { super::avr_gnu_base::target("atmega328".to_owned()) } diff --git a/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs index 0976acb4fb0..65b305aa84b 100644 --- a/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkArgs, LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkArgs, LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "hexagonv60".to_string(); base.max_atomic_width = Some(32); @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { base.pre_link_args = LinkArgs::new(); base.post_link_args = LinkArgs::new(); - Ok(Target { + Target { llvm_target: "hexagon-unknown-linux-musl".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -35,5 +35,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i386_apple_ios.rs b/compiler/rustc_target/src/spec/i386_apple_ios.rs index 6cb209ab1c0..4f6b8b25842 100644 --- a/compiler/rustc_target/src/spec/i386_apple_ios.rs +++ b/compiler/rustc_target/src/spec/i386_apple_ios.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::I386); - Ok(Target { + Target { llvm_target: "i386-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { max_atomic_width: Some(64), stack_probes: true, ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/i586_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/i586_pc_windows_msvc.rs index ba712aced84..664b9d5d515 100644 --- a/compiler/rustc_target/src/spec/i586_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/i586_pc_windows_msvc.rs @@ -1,8 +1,8 @@ -use crate::spec::TargetResult; +use crate::spec::Target; -pub fn target() -> TargetResult { - let mut base = super::i686_pc_windows_msvc::target()?; +pub fn target() -> Target { + let mut base = super::i686_pc_windows_msvc::target(); base.options.cpu = "pentium".to_string(); base.llvm_target = "i586-pc-windows-msvc".to_string(); - Ok(base) + base } diff --git a/compiler/rustc_target/src/spec/i586_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/i586_unknown_linux_gnu.rs index 49f4f2cb6b9..3276f1d0094 100644 --- a/compiler/rustc_target/src/spec/i586_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/i586_unknown_linux_gnu.rs @@ -1,8 +1,8 @@ -use crate::spec::TargetResult; +use crate::spec::Target; -pub fn target() -> TargetResult { - let mut base = super::i686_unknown_linux_gnu::target()?; +pub fn target() -> Target { + let mut base = super::i686_unknown_linux_gnu::target(); base.options.cpu = "pentium".to_string(); base.llvm_target = "i586-unknown-linux-gnu".to_string(); - Ok(base) + base } diff --git a/compiler/rustc_target/src/spec/i586_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/i586_unknown_linux_musl.rs index 0f2ccebd6da..5fbf0487226 100644 --- a/compiler/rustc_target/src/spec/i586_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/i586_unknown_linux_musl.rs @@ -1,8 +1,8 @@ -use crate::spec::TargetResult; +use crate::spec::Target; -pub fn target() -> TargetResult { - let mut base = super::i686_unknown_linux_musl::target()?; +pub fn target() -> Target { + let mut base = super::i686_unknown_linux_musl::target(); base.options.cpu = "pentium".to_string(); base.llvm_target = "i586-unknown-linux-musl".to_string(); - Ok(base) + base } diff --git a/compiler/rustc_target/src/spec/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/i686_apple_darwin.rs index b7a34f9740a..62a0e415094 100644 --- a/compiler/rustc_target/src/spec/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/i686_apple_darwin.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::apple_base::opts(); base.cpu = "yonah".to_string(); base.max_atomic_width = Some(64); @@ -15,7 +15,7 @@ pub fn target() -> TargetResult { let arch = "i686"; let llvm_target = super::apple_base::macos_llvm_target(&arch); - Ok(Target { + Target { llvm_target, target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -29,5 +29,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_linux_android.rs b/compiler/rustc_target/src/spec/i686_linux_android.rs index 79242f24026..529e0d39290 100644 --- a/compiler/rustc_target/src/spec/i686_linux_android.rs +++ b/compiler/rustc_target/src/spec/i686_linux_android.rs @@ -1,9 +1,9 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; // See https://developer.android.com/ndk/guides/abis.html#x86 // for target ABI requirements. -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::android_base::opts(); base.max_atomic_width = Some(64); @@ -13,7 +13,7 @@ pub fn target() -> TargetResult { base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".to_string(); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-linux-android".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -27,5 +27,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs index 33c9008bb14..64a975ee1bc 100644 --- a/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_gnu_base::opts(); base.cpu = "pentium4".to_string(); base.pre_link_args @@ -16,7 +16,7 @@ pub fn target() -> TargetResult { .unwrap() .push("-Wl,--large-address-aware".to_string()); - Ok(Target { + Target { llvm_target: "i686-pc-windows-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -30,5 +30,5 @@ pub fn target() -> TargetResult { target_vendor: "pc".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs index 9d0922b8ce5..2de1f07844e 100644 --- a/compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -20,7 +20,7 @@ pub fn target() -> TargetResult { .unwrap() .extend(pre_link_args_msvc); - Ok(Target { + Target { llvm_target: "i686-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -34,5 +34,5 @@ pub fn target() -> TargetResult { target_vendor: "pc".to_string(), linker_flavor: LinkerFlavor::Msvc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_cloudabi.rs b/compiler/rustc_target/src/spec/i686_unknown_cloudabi.rs index 729b1f68e00..6cd34f38c57 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_cloudabi.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_cloudabi.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::cloudabi_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-cloudabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_freebsd.rs b/compiler/rustc_target/src/spec/i686_unknown_freebsd.rs index 60f2188514e..691820a3010 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_freebsd.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::freebsd_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { pre_link_args.push("-Wl,-znotext".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-freebsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -23,5 +23,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_haiku.rs b/compiler/rustc_target/src/spec/i686_unknown_haiku.rs index 4dc27af30da..cfc3a74104b 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_haiku.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_haiku.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::haiku_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-haiku".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs index 0d578f22f98..1e0efca8eed 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs index 699a0ab45e8..6e4259176cf 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_linux_musl.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { // https://llvm.org/bugs/show_bug.cgi?id=30879 base.eliminate_frame_pointer = false; - Ok(Target { + Target { llvm_target: "i686-unknown-linux-musl".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -36,5 +36,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_netbsd.rs b/compiler/rustc_target/src/spec/i686_unknown_netbsd.rs index 88b1ae7d53c..7305578ab6a 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_netbsd.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-netbsdelf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_openbsd.rs b/compiler/rustc_target/src/spec/i686_unknown_openbsd.rs index 829cd1ac1a3..f5b292685fa 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_openbsd.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::openbsd_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-fuse-ld=lld".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-openbsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_unknown_uefi.rs b/compiler/rustc_target/src/spec/i686_unknown_uefi.rs index 221d5f0785c..bb3b0b70744 100644 --- a/compiler/rustc_target/src/spec/i686_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/i686_unknown_uefi.rs @@ -5,9 +5,9 @@ // The cdecl ABI is used. It differs from the stdcall or fastcall ABI. // "i686-unknown-windows" is used to get the minimal subset of windows-specific features. -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::uefi_msvc_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); @@ -76,7 +76,7 @@ pub fn target() -> TargetResult { // As a result, we choose -gnu for i686 version before those intrisics are implemented in // compiler-builtins. After compiler-builtins implements all required intrinsics, we may // remove -gnu and use the default one. - Ok(Target { + Target { llvm_target: "i686-unknown-windows-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -91,5 +91,5 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Lld(LldFlavor::Link), options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/i686_uwp_windows_gnu.rs index 1c6d2e061bc..100e0706bc1 100644 --- a/compiler/rustc_target/src/spec/i686_uwp_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/i686_uwp_windows_gnu.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_uwp_gnu_base::opts(); base.cpu = "pentium4".to_string(); base.pre_link_args @@ -15,7 +15,7 @@ pub fn target() -> TargetResult { .unwrap() .push("-Wl,--large-address-aware".to_string()); - Ok(Target { + Target { llvm_target: "i686-pc-windows-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -29,5 +29,5 @@ pub fn target() -> TargetResult { target_vendor: "uwp".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs index ed2dba53589..d4426a4eb9e 100644 --- a/compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_uwp_msvc_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.has_elf_tls = true; - Ok(Target { + Target { llvm_target: "i686-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "uwp".to_string(), linker_flavor: LinkerFlavor::Msvc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/i686_wrs_vxworks.rs b/compiler/rustc_target/src/spec/i686_wrs_vxworks.rs index f5f66cabb2c..8320beefb27 100644 --- a/compiler/rustc_target/src/spec/i686_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/i686_wrs_vxworks.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::vxworks_base::opts(); base.cpu = "pentium4".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "i686-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "wrs".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs index b2ea8a6f388..f20d337931e 100644 --- a/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mips64-unknown-linux-gnuabi64".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/mips64_unknown_linux_muslabi64.rs index 17584de1144..edddcd616bf 100644 --- a/compiler/rustc_target/src/spec/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/mips64_unknown_linux_muslabi64.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "mips64r2".to_string(); base.features = "+mips64r2".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".to_string(), target_endian: "big".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs index 48aea4a39b0..031c5229f7e 100644 --- a/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mips64el-unknown-linux-gnuabi64".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/mips64el_unknown_linux_muslabi64.rs index c7a849a1641..d76d0d3930b 100644 --- a/compiler/rustc_target/src/spec/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/mips64el_unknown_linux_muslabi64.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "mips64r2".to_string(); base.features = "+mips64r2".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64el-unknown-linux-musl".to_string(), target_endian: "little".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/mips_unknown_linux_gnu.rs index e360abdb38d..ebead1ce64f 100644 --- a/compiler/rustc_target/src/spec/mips_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/mips_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mips-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/mips_unknown_linux_musl.rs index c8d97e600d4..0042244569a 100644 --- a/compiler/rustc_target/src/spec/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/mips_unknown_linux_musl.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "mips32r2".to_string(); base.features = "+mips32r2,+soft-float".to_string(); base.max_atomic_width = Some(32); base.crt_static_default = false; - Ok(Target { + Target { llvm_target: "mips-unknown-linux-musl".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mips_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/mips_unknown_linux_uclibc.rs index 8116b8c9cc8..bdb9be4a027 100644 --- a/compiler/rustc_target/src/spec/mips_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/mips_unknown_linux_uclibc.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mips-unknown-linux-uclibc".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsel_sony_psp.rs b/compiler/rustc_target/src/spec/mipsel_sony_psp.rs index b3bda97c8a5..5d8ad510d60 100644 --- a/compiler/rustc_target/src/spec/mipsel_sony_psp.rs +++ b/compiler/rustc_target/src/spec/mipsel_sony_psp.rs @@ -1,14 +1,14 @@ use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; // The PSP has custom linker requirements. const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut pre_link_args = LinkArgs::new(); pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["--emit-relocs".to_string()]); - Ok(Target { + Target { llvm_target: "mipsel-sony-psp".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -36,5 +36,5 @@ pub fn target() -> TargetResult { link_script: Some(LINKER_SCRIPT.to_string()), ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsel_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/mipsel_unknown_linux_gnu.rs index 7e9d8cd942a..ef585a4bc37 100644 --- a/compiler/rustc_target/src/spec/mipsel_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/mipsel_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mipsel-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/mipsel_unknown_linux_musl.rs index f70cc13224f..3552abd0968 100644 --- a/compiler/rustc_target/src/spec/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/mipsel_unknown_linux_musl.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "mips32r2".to_string(); base.features = "+mips32r2,+soft-float".to_string(); base.max_atomic_width = Some(32); base.crt_static_default = false; - Ok(Target { + Target { llvm_target: "mipsel-unknown-linux-musl".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsel_unknown_linux_uclibc.rs b/compiler/rustc_target/src/spec/mipsel_unknown_linux_uclibc.rs index a8152011efa..b52ae5cc016 100644 --- a/compiler/rustc_target/src/spec/mipsel_unknown_linux_uclibc.rs +++ b/compiler/rustc_target/src/spec/mipsel_unknown_linux_uclibc.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mipsel-unknown-linux-uclibc".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsisa32r6_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/mipsisa32r6_unknown_linux_gnu.rs index 36b83c63fca..10ec589ef20 100644 --- a/compiler/rustc_target/src/spec/mipsisa32r6_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/mipsisa32r6_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mipsisa32r6-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsisa32r6el_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/mipsisa32r6el_unknown_linux_gnu.rs index 717ae3f1d20..8157cac4170 100644 --- a/compiler/rustc_target/src/spec/mipsisa32r6el_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/mipsisa32r6el_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mipsisa32r6el-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsisa64r6_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mipsisa64r6_unknown_linux_gnuabi64.rs index 3f7d233e55f..e5d565f653c 100644 --- a/compiler/rustc_target/src/spec/mipsisa64r6_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/mipsisa64r6_unknown_linux_gnuabi64.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mipsisa64r6-unknown-linux-gnuabi64".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mipsisa64r6el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mipsisa64r6el_unknown_linux_gnuabi64.rs index 4f41b8323a9..5f68c6484c0 100644 --- a/compiler/rustc_target/src/spec/mipsisa64r6el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/mipsisa64r6el_unknown_linux_gnuabi64.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "mipsisa64r6el-unknown-linux-gnuabi64".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index f1e8330425e..359f5d1fde8 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -436,7 +436,6 @@ pub enum LoadTargetError { } pub type LinkArgs = BTreeMap>; -pub type TargetResult = Result; macro_rules! supported_targets { ( $(($( $triple:literal, )+ $module:ident ),)+ ) => { @@ -449,8 +448,7 @@ macro_rules! supported_targets { match target { $( $($triple)|+ => { - let mut t = $module::target() - .map_err(LoadTargetError::Other)?; + let mut t = $module::target(); t.options.is_builtin = true; // round-trip through the JSON parser to ensure at @@ -1135,7 +1133,7 @@ impl Target { } /// Loads a target descriptor from a JSON object. - pub fn from_json(obj: Json) -> TargetResult { + pub fn from_json(obj: Json) -> Result { // While ugly, this code must remain this way to retain // compatibility with existing JSON fields and the internal // expected naming of the Target and TargetOptions structs. diff --git a/compiler/rustc_target/src/spec/msp430_none_elf.rs b/compiler/rustc_target/src/spec/msp430_none_elf.rs index f75697996ac..9274d750c7c 100644 --- a/compiler/rustc_target/src/spec/msp430_none_elf.rs +++ b/compiler/rustc_target/src/spec/msp430_none_elf.rs @@ -1,7 +1,7 @@ -use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "msp430-none-elf".to_string(), target_endian: "little".to_string(), target_pointer_width: "16".to_string(), @@ -60,5 +60,5 @@ pub fn target() -> TargetResult { ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs b/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs index 0c8f2a34301..e44534a288d 100644 --- a/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs +++ b/compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs @@ -1,10 +1,8 @@ use crate::spec::abi::Abi; -use crate::spec::{ - LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions, TargetResult, -}; +use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { arch: "nvptx64".to_string(), data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(), llvm_target: "nvptx64-nvidia-cuda".to_string(), @@ -71,5 +69,5 @@ pub fn target() -> TargetResult { ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/powerpc64_unknown_freebsd.rs index 60c15d6b7d2..ab889387e2b 100644 --- a/compiler/rustc_target/src/spec/powerpc64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/powerpc64_unknown_freebsd.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::freebsd_base::opts(); base.cpu = "ppc64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "powerpc64-unknown-freebsd".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs index 5306d905c5d..84a19e8a047 100644 --- a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "ppc64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); @@ -10,7 +10,7 @@ pub fn target() -> TargetResult { // for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474 base.relro_level = RelroLevel::Partial; - Ok(Target { + Target { llvm_target: "powerpc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs index c3b956effae..c320d10e6c1 100644 --- a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "ppc64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "powerpc64-unknown-linux-musl".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs index e00a927c3a4..257a0932080 100644 --- a/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::vxworks_base::opts(); base.cpu = "ppc64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "powerpc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "wrs".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs index 90737994612..5d501f840b6 100644 --- a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "ppc64le".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "powerpc64le-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs index 1a1fccfab02..847e8abf299 100644 --- a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "ppc64le".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "powerpc64le-unknown-linux-musl".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnu.rs index 2d4c5986637..5f55a233fc4 100644 --- a/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "powerpc-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnuspe.rs b/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnuspe.rs index fabc4313bee..b3c3a2fe242 100644 --- a/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnuspe.rs +++ b/compiler/rustc_target/src/spec/powerpc_unknown_linux_gnuspe.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string()); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "powerpc-unknown-linux-gnuspe".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc_unknown_linux_musl.rs index 240cbcbfe6e..804f223ba6e 100644 --- a/compiler/rustc_target/src/spec/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/powerpc_unknown_linux_musl.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "powerpc-unknown-linux-musl".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "_mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc_unknown_netbsd.rs b/compiler/rustc_target/src/spec/powerpc_unknown_netbsd.rs index 6ca7053ced5..5be35dbdc89 100644 --- a/compiler/rustc_target/src/spec/powerpc_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/powerpc_unknown_netbsd.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "powerpc-unknown-netbsd".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc_wrs_vxworks.rs b/compiler/rustc_target/src/spec/powerpc_wrs_vxworks.rs index 2211dc29a5d..44338c066e6 100644 --- a/compiler/rustc_target/src/spec/powerpc_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/powerpc_wrs_vxworks.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::vxworks_base::opts(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string()); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "powerpc-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "wrs".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { features: "+secure-plt".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/powerpc_wrs_vxworks_spe.rs b/compiler/rustc_target/src/spec/powerpc_wrs_vxworks_spe.rs index b10182c09ad..e2dc7858d2c 100644 --- a/compiler/rustc_target/src/spec/powerpc_wrs_vxworks_spe.rs +++ b/compiler/rustc_target/src/spec/powerpc_wrs_vxworks_spe.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::vxworks_base::opts(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mspe".to_string()); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("--secure-plt".to_string()); base.max_atomic_width = Some(32); - Ok(Target { + Target { llvm_target: "powerpc-unknown-linux-gnuspe".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { features: "+secure-plt,+msync".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs index 28710c60175..bce690662b8 100644 --- a/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/riscv32gc_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ -use crate::spec::{CodeModel, LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{CodeModel, LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "riscv32-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { max_atomic_width: Some(32), ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs index 5b5e342000b..83e27c4d838 100644 --- a/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs @@ -1,8 +1,8 @@ use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), llvm_target: "riscv32".to_string(), target_endian: "little".to_string(), @@ -28,5 +28,5 @@ pub fn target() -> TargetResult { eh_frame_header: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs index 4cef5c42d8d..e2154f58494 100644 --- a/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs @@ -1,8 +1,8 @@ use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), llvm_target: "riscv32".to_string(), target_endian: "little".to_string(), @@ -28,5 +28,5 @@ pub fn target() -> TargetResult { eh_frame_header: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs index 8ad563e441d..845a80a06c7 100644 --- a/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv32imc_unknown_none_elf.rs @@ -1,8 +1,8 @@ use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), llvm_target: "riscv32".to_string(), target_endian: "little".to_string(), @@ -28,5 +28,5 @@ pub fn target() -> TargetResult { eh_frame_header: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs index f7a93c916d1..2cd3b952618 100644 --- a/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs @@ -1,7 +1,7 @@ -use crate::spec::{CodeModel, LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{CodeModel, LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "riscv64-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { max_atomic_width: Some(64), ..super::linux_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs index 3aeb3f3ca72..1f857159f0c 100644 --- a/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv64gc_unknown_none_elf.rs @@ -1,8 +1,8 @@ use crate::spec::{CodeModel, LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions, TargetResult}; +use crate::spec::{Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(), llvm_target: "riscv64".to_string(), target_endian: "little".to_string(), @@ -29,5 +29,5 @@ pub fn target() -> TargetResult { eh_frame_header: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs index d8144964dc9..c407fd9557d 100644 --- a/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/riscv64imac_unknown_none_elf.rs @@ -1,8 +1,8 @@ -use crate::spec::{CodeModel, Target, TargetOptions, TargetResult}; +use crate::spec::{CodeModel, Target, TargetOptions}; use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(), llvm_target: "riscv64".to_string(), target_endian: "little".to_string(), @@ -29,5 +29,5 @@ pub fn target() -> TargetResult { eh_frame_header: false, ..Default::default() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs index f259787e1d5..ed1c96f1d7b 100644 --- a/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/s390x_unknown_linux_gnu.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); // z10 is the oldest CPU supported by LLVM base.cpu = "z10".to_string(); @@ -11,7 +11,7 @@ pub fn target() -> TargetResult { base.max_atomic_width = Some(64); base.min_global_align = Some(16); - Ok(Target { + Target { llvm_target: "s390x-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -23,5 +23,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/sparc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/sparc64_unknown_linux_gnu.rs index c842b22d4e1..8b540a717ce 100644 --- a/compiler/rustc_target/src/spec/sparc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/sparc64_unknown_linux_gnu.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "v9".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "sparc64-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/sparc64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/sparc64_unknown_netbsd.rs index aad85e852f0..cfdc43547ff 100644 --- a/compiler/rustc_target/src/spec/sparc64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/sparc64_unknown_netbsd.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.cpu = "v9".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "sparc64-unknown-netbsd".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/sparc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/sparc64_unknown_openbsd.rs index 229e0621e0d..6f2eaeee32a 100644 --- a/compiler/rustc_target/src/spec/sparc64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/sparc64_unknown_openbsd.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::openbsd_base::opts(); base.cpu = "v9".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "sparc64-unknown-openbsd".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs index 162cd311a38..ea02db7e5bb 100644 --- a/compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "v9".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-mv8plus".to_string()); - Ok(Target { + Target { llvm_target: "sparc-unknown-linux-gnu".to_string(), target_endian: "big".to_string(), target_pointer_width: "32".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs b/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs index acc03fd0d79..747f70e65c5 100644 --- a/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs +++ b/compiler/rustc_target/src/spec/sparcv9_sun_solaris.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::solaris_base::opts(); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]); // llvm calls this "v9" base.cpu = "v9".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "sparcv9-sun-solaris".to_string(), target_endian: "big".to_string(), target_pointer_width: "64".to_string(), @@ -23,5 +23,5 @@ pub fn target() -> TargetResult { target_vendor: "sun".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/tests/tests_impl.rs b/compiler/rustc_target/src/spec/tests/tests_impl.rs index b2c2b8254d8..d06ab368e1c 100644 --- a/compiler/rustc_target/src/spec/tests/tests_impl.rs +++ b/compiler/rustc_target/src/spec/tests/tests_impl.rs @@ -1,16 +1,9 @@ use super::super::*; -pub(super) fn test_target(target: TargetResult) { - // Grab the TargetResult struct. If we successfully retrieved - // a Target, then the test JSON encoding/decoding can run for this - // Target on this testing platform (i.e., checking the iOS targets - // only on a Mac test platform). - if let Ok(original) = target { - original.check_consistency(); - let as_json = original.to_json(); - let parsed = Target::from_json(as_json).unwrap(); - assert_eq!(original, parsed); - } +// Test target self-consistency and JSON encoding/decoding roundtrip. +pub(super) fn test_target(target: Target) { + target.check_consistency(); + assert_eq!(Target::from_json(target.to_json()), Ok(target)); } impl Target { diff --git a/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs index a8c78f057fc..1a58a9111f0 100644 --- a/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs @@ -8,10 +8,10 @@ //! //! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv4t-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -58,5 +58,5 @@ pub fn target() -> TargetResult { ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs index 953d60fcc22..bd1367ddb42 100644 --- a/compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs @@ -1,9 +1,9 @@ // Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture) -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv6m-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -24,5 +24,5 @@ pub fn target() -> TargetResult { atomic_cas: false, ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs index 37828026fe1..01a3598572d 100644 --- a/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/thumbv7a_pc_windows_msvc.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); // Prevent error LNK2013: BRANCH24(T) fixup overflow @@ -21,7 +21,7 @@ pub fn target() -> TargetResult { // implemented for windows/arm in LLVM base.panic_strategy = PanicStrategy::Abort; - Ok(Target { + Target { llvm_target: "thumbv7a-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -40,5 +40,5 @@ pub fn target() -> TargetResult { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs index 29a4a9875e5..af4741c77ab 100644 --- a/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/thumbv7a_uwp_windows_msvc.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_uwp_msvc_base::opts(); base.max_atomic_width = Some(64); base.has_elf_tls = true; @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { // implemented for windows/arm in LLVM base.panic_strategy = PanicStrategy::Abort; - Ok(Target { + Target { llvm_target: "thumbv7a-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7em_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv7em_none_eabi.rs index 9e085381953..10e1050fbf5 100644 --- a/compiler/rustc_target/src/spec/thumbv7em_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv7em_none_eabi.rs @@ -9,10 +9,10 @@ // To opt-in to hardware accelerated floating point operations, you can use, for example, // `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`. -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv7em-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -25,5 +25,5 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: TargetOptions { max_atomic_width: Some(32), ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7em_none_eabihf.rs b/compiler/rustc_target/src/spec/thumbv7em_none_eabihf.rs index 95b9b9d5b56..17a5b70bc09 100644 --- a/compiler/rustc_target/src/spec/thumbv7em_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/thumbv7em_none_eabihf.rs @@ -8,10 +8,10 @@ // // To opt into double precision hardware support, use the `-C target-feature=+fp64` flag. -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv7em-none-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -37,5 +37,5 @@ pub fn target() -> TargetResult { max_atomic_width: Some(32), ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7m_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv7m_none_eabi.rs index 528359ffad3..c21cb5d03d4 100644 --- a/compiler/rustc_target/src/spec/thumbv7m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv7m_none_eabi.rs @@ -1,9 +1,9 @@ // Targets the Cortex-M3 processor (ARMv7-M) -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv7m-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: TargetOptions { max_atomic_width: Some(32), ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs b/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs index c52f077f6f1..8c4750d7731 100644 --- a/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/thumbv7neon_linux_androideabi.rs @@ -1,4 +1,4 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target if is for the Android v7a ABI in thumb mode with // NEON unconditionally enabled and, therefore, with 32 FPU registers @@ -8,13 +8,13 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; // See https://developer.android.com/ndk/guides/abis.html#v7a // for target ABI requirements. -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::android_base::opts(); base.features = "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string()); - Ok(Target { + Target { llvm_target: "armv7-none-linux-android".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs index 78936948e64..85bdc16727b 100644 --- a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_gnueabihf.rs @@ -1,4 +1,4 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target is for glibc Linux on ARMv7 with thumb mode enabled // (for consistency with Android and Debian-based distributions) @@ -6,9 +6,9 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; // registers enabled as well. See section A2.6.2 on page A2-56 in // https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_base::opts(); - Ok(Target { + Target { llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -28,5 +28,5 @@ pub fn target() -> TargetResult { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs index f759c3eeb01..b97b5270d42 100644 --- a/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/thumbv7neon_unknown_linux_musleabihf.rs @@ -1,4 +1,4 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; // This target is for musl Linux on ARMv7 with thumb mode enabled // (for consistency with Android and Debian-based distributions) @@ -6,9 +6,9 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; // registers enabled as well. See section A2.6.2 on page A2-56 in // https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = super::linux_musl_base::opts(); - Ok(Target { + Target { // It's important we use "gnueabihf" and not "musleabihf" here. LLVM // uses it to determine the calling convention and float ABI, and LLVM // doesn't support the "musleabihf" value. @@ -33,5 +33,5 @@ pub fn target() -> TargetResult { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv8m_base_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv8m_base_none_eabi.rs index 3f67c67b7bc..9eb33f5ef66 100644 --- a/compiler/rustc_target/src/spec/thumbv8m_base_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv8m_base_none_eabi.rs @@ -1,9 +1,9 @@ // Targets the Cortex-M23 processor (Baseline ARMv8-M) -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv8m.base-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { max_atomic_width: Some(32), ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv8m_main_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv8m_main_none_eabi.rs index 2f8103f0c70..55b8b545e79 100644 --- a/compiler/rustc_target/src/spec/thumbv8m_main_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv8m_main_none_eabi.rs @@ -1,10 +1,10 @@ // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), // without the Floating Point extension. -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv8m.main-none-eabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -17,5 +17,5 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: TargetOptions { max_atomic_width: Some(32), ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/thumbv8m_main_none_eabihf.rs b/compiler/rustc_target/src/spec/thumbv8m_main_none_eabihf.rs index 53a340230d6..f17d48e8523 100644 --- a/compiler/rustc_target/src/spec/thumbv8m_main_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/thumbv8m_main_none_eabihf.rs @@ -1,10 +1,10 @@ // Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), // with the Floating Point extension. -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { - Ok(Target { +pub fn target() -> Target { + Target { llvm_target: "thumbv8m.main-none-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { max_atomic_width: Some(32), ..super::thumb_base::opts() }, - }) + } } diff --git a/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs b/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs index 1916639170e..4f99967f21b 100644 --- a/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs @@ -1,7 +1,7 @@ use super::wasm32_base; use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions}; -pub fn target() -> Result { +pub fn target() -> Target { let mut post_link_args = LinkArgs::new(); post_link_args.insert( LinkerFlavor::Em, @@ -28,7 +28,7 @@ pub fn target() -> Result { target_family: Some("unix".to_string()), ..wasm32_base::options() }; - Ok(Target { + Target { llvm_target: "wasm32-unknown-emscripten".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -40,5 +40,5 @@ pub fn target() -> Result { arch: "wasm32".to_string(), linker_flavor: LinkerFlavor::Em, options: opts, - }) + } } diff --git a/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs b/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs index ded95a34d55..f0b6979ce11 100644 --- a/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs +++ b/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs @@ -13,7 +13,7 @@ use super::wasm32_base; use super::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> Result { +pub fn target() -> Target { let mut options = wasm32_base::options(); let clang_args = options.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap(); @@ -30,7 +30,7 @@ pub fn target() -> Result { .unwrap() .push("--no-entry".to_string()); - Ok(Target { + Target { llvm_target: "wasm32-unknown-unknown".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -42,5 +42,5 @@ pub fn target() -> Result { arch: "wasm32".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Wasm), options, - }) + } } diff --git a/compiler/rustc_target/src/spec/wasm32_wasi.rs b/compiler/rustc_target/src/spec/wasm32_wasi.rs index 351167105ec..f8fdbf44b19 100644 --- a/compiler/rustc_target/src/spec/wasm32_wasi.rs +++ b/compiler/rustc_target/src/spec/wasm32_wasi.rs @@ -75,7 +75,7 @@ use super::wasm32_base; use super::{crt_objects, LinkerFlavor, LldFlavor, Target}; -pub fn target() -> Result { +pub fn target() -> Target { let mut options = wasm32_base::options(); options @@ -104,7 +104,7 @@ pub fn target() -> Result { // `args::args()` makes the WASI API calls itself. options.main_needs_argc_argv = false; - Ok(Target { + Target { llvm_target: "wasm32-wasi".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -116,5 +116,5 @@ pub fn target() -> Result { arch: "wasm32".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Wasm), options, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs index 909aebec70b..45e8ddd6137 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::apple_base::opts(); base.cpu = "core2".to_string(); base.max_atomic_width = Some(128); // core2 support cmpxchg16b @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { let arch = "x86_64"; let llvm_target = super::apple_base::macos_llvm_target(&arch); - Ok(Target { + Target { llvm_target, target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -31,5 +31,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/x86_64_apple_ios.rs index fd3e4e2f57b..b4590f7aed2 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_ios.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::X86_64); - Ok(Target { + Target { llvm_target: "x86_64-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { max_atomic_width: Some(64), stack_probes: true, ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs index 4cfbd9eba06..85cc4e6db6f 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::X86_64_macabi); - Ok(Target { + Target { llvm_target: "x86_64-apple-ios13.0-macabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -16,5 +16,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { max_atomic_width: Some(64), stack_probes: true, ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/x86_64_apple_tvos.rs index 664a3ed8816..db466400562 100644 --- a/compiler/rustc_target/src/spec/x86_64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/x86_64_apple_tvos.rs @@ -1,9 +1,9 @@ use super::apple_sdk_base::{opts, Arch}; -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let base = opts(Arch::X86_64); - Ok(Target { + Target { llvm_target: "x86_64-apple-tvos".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -15,5 +15,5 @@ pub fn target() -> TargetResult { target_vendor: "apple".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { max_atomic_width: Some(64), stack_probes: true, ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_fortanix_unknown_sgx.rs b/compiler/rustc_target/src/spec/x86_64_fortanix_unknown_sgx.rs index 3b5233a3e67..cc27d88bff1 100644 --- a/compiler/rustc_target/src/spec/x86_64_fortanix_unknown_sgx.rs +++ b/compiler/rustc_target/src/spec/x86_64_fortanix_unknown_sgx.rs @@ -2,7 +2,7 @@ use std::iter; use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions}; -pub fn target() -> Result { +pub fn target() -> Target { const PRE_LINK_ARGS: &[&str] = &[ "--as-needed", "-z", @@ -74,7 +74,7 @@ pub fn target() -> Result { relax_elf_relocations: true, ..Default::default() }; - Ok(Target { + Target { llvm_target: "x86_64-elf".into(), target_endian: "little".into(), target_pointer_width: "64".into(), @@ -87,5 +87,5 @@ pub fn target() -> Result { arch: "x86_64".into(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: opts, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_fuchsia.rs b/compiler/rustc_target/src/spec/x86_64_fuchsia.rs index 37b6d57366c..887b3b67edd 100644 --- a/compiler/rustc_target/src/spec/x86_64_fuchsia.rs +++ b/compiler/rustc_target/src/spec/x86_64_fuchsia.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::fuchsia_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-fuchsia".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -19,5 +19,5 @@ pub fn target() -> TargetResult { target_vendor: String::new(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_linux_android.rs b/compiler/rustc_target/src/spec/x86_64_linux_android.rs index 74097f5bf6f..44c869d1e30 100644 --- a/compiler/rustc_target/src/spec/x86_64_linux_android.rs +++ b/compiler/rustc_target/src/spec/x86_64_linux_android.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::android_base::opts(); base.cpu = "x86-64".to_string(); // https://developer.android.com/ndk/guides/abis.html#86-64 @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-linux-android".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_linux_kernel.rs b/compiler/rustc_target/src/spec/x86_64_linux_kernel.rs index 65bb97d84aa..b9507ad9c8e 100644 --- a/compiler/rustc_target/src/spec/x86_64_linux_kernel.rs +++ b/compiler/rustc_target/src/spec/x86_64_linux_kernel.rs @@ -1,9 +1,9 @@ // This defines the amd64 target for the Linux Kernel. See the linux-kernel-base module for // generic Linux kernel options. -use crate::spec::{CodeModel, LinkerFlavor, Target, TargetResult}; +use crate::spec::{CodeModel, LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_kernel_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -13,7 +13,7 @@ pub fn target() -> TargetResult { base.code_model = Some(CodeModel::Kernel); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); - Ok(Target { + Target { // FIXME: Some dispute, the linux-on-clang folks think this should use "Linux" llvm_target: "x86_64-elf".to_string(), target_endian: "little".to_string(), @@ -28,5 +28,5 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs b/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs index 99af483f1d4..e93755d1aa4 100644 --- a/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/x86_64_pc_windows_gnu.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_gnu_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { base.max_atomic_width = Some(64); base.linker = Some("x86_64-w64-mingw32-gcc".to_string()); - Ok(Target { + Target { llvm_target: "x86_64-pc-windows-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "pc".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/x86_64_pc_windows_msvc.rs index 75ff6b97a2e..ffb0eb43beb 100644 --- a/compiler/rustc_target/src/spec/x86_64_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/x86_64_pc_windows_msvc.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_msvc_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.has_elf_tls = true; - Ok(Target { + Target { llvm_target: "x86_64-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -19,5 +19,5 @@ pub fn target() -> TargetResult { target_vendor: "pc".to_string(), linker_flavor: LinkerFlavor::Msvc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_rumprun_netbsd.rs b/compiler/rustc_target/src/spec/x86_64_rumprun_netbsd.rs index fbade02c556..3d97f4315ec 100644 --- a/compiler/rustc_target/src/spec/x86_64_rumprun_netbsd.rs +++ b/compiler/rustc_target/src/spec/x86_64_rumprun_netbsd.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); @@ -13,7 +13,7 @@ pub fn target() -> TargetResult { base.disable_redzone = true; base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-rumprun-netbsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -26,5 +26,5 @@ pub fn target() -> TargetResult { target_vendor: "rumprun".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs b/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs index 53f4df96518..5c6be285360 100644 --- a/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs +++ b/compiler/rustc_target/src/spec/x86_64_sun_solaris.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::solaris_base::opts(); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-pc-solaris".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "sun".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_cloudabi.rs b/compiler/rustc_target/src/spec/x86_64_unknown_cloudabi.rs index dbc5f965020..c002671552f 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_cloudabi.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_cloudabi.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::cloudabi_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-cloudabi".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_dragonfly.rs b/compiler/rustc_target/src/spec/x86_64_unknown_dragonfly.rs index fd1871b1a57..1390926ed3f 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_dragonfly.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_dragonfly.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::dragonfly_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-dragonfly".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/x86_64_unknown_freebsd.rs index a124f582bf3..424f0343ec9 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_freebsd.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::freebsd_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-freebsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_haiku.rs b/compiler/rustc_target/src/spec/x86_64_unknown_haiku.rs index 51237697714..2f9be167b9b 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_haiku.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_haiku.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::haiku_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { // This option is required to build executables on Haiku x86_64 base.position_independent_executables = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-haiku".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_hermit.rs b/compiler/rustc_target/src/spec/x86_64_unknown_hermit.rs index 4a526f90ed5..0da92f035a5 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_hermit.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_hermit.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::hermit_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.features = "+rdrnd,+rdseed".to_string(); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-hermit".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_hermit_kernel.rs b/compiler/rustc_target/src/spec/x86_64_unknown_hermit_kernel.rs index c25cd0809ee..ea955e758bb 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_hermit_kernel.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_hermit_kernel.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::hermit_kernel_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -9,7 +9,7 @@ pub fn target() -> TargetResult { .to_string(); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-hermit".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -22,5 +22,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_illumos.rs b/compiler/rustc_target/src/spec/x86_64_unknown_illumos.rs index 2567ca47ef9..482748f5b3d 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_illumos.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_illumos.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::illumos_base::opts(); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string(), "-std=c99".to_string()]); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { // LLVM does not currently have a separate illumos target, // so we still pass Solaris to it llvm_target: "x86_64-pc-solaris".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs b/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs index cab19f149a7..65e080d3066 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_l4re_uclibc.rs @@ -1,11 +1,11 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::l4re_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "x86_64-unknown-l4re-uclibc".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -18,5 +18,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Ld, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs index 29cbb777db5..66df76cad69 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnux32.rs b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnux32.rs index 0a37399e2fa..81dae46b8a3 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnux32.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnux32.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -11,7 +11,7 @@ pub fn target() -> TargetResult { // breaks code gen. See LLVM bug 36743 base.needs_plt = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-linux-gnux32".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -25,5 +25,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs index 3a22290da68..e513df790be 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_linux_musl.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::linux_musl_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { base.stack_probes = true; base.static_position_independent_executables = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-linux-musl".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_netbsd.rs b/compiler/rustc_target/src/spec/x86_64_unknown_netbsd.rs index adf09c89c42..9c984f169a6 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_netbsd.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_netbsd.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use crate::spec::{LinkerFlavor, Target, TargetOptions}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::netbsd_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-netbsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { target_mcount: "__mcount".to_string(), ..base }, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/x86_64_unknown_openbsd.rs index dbd163db36b..d9110c882c1 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_openbsd.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_openbsd.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::openbsd_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-openbsd".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_redox.rs b/compiler/rustc_target/src/spec/x86_64_unknown_redox.rs index 3d40bafbe1f..42af9c799bd 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_redox.rs @@ -1,13 +1,13 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::redox_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.stack_probes = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-redox".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -20,5 +20,5 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs index 849227a574a..17d75a96713 100644 --- a/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/x86_64_unknown_uefi.rs @@ -5,9 +5,9 @@ // The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with // LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features. -use crate::spec::{CodeModel, LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{CodeModel, LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::uefi_msvc_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -28,7 +28,7 @@ pub fn target() -> TargetResult { // places no locality-restrictions, so it fits well here. base.code_model = Some(CodeModel::Large); - Ok(Target { + Target { llvm_target: "x86_64-unknown-windows".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -42,5 +42,5 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Lld(LldFlavor::Link), options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_uwp_windows_gnu.rs b/compiler/rustc_target/src/spec/x86_64_uwp_windows_gnu.rs index 3bd18f23f6f..b288271406c 100644 --- a/compiler/rustc_target/src/spec/x86_64_uwp_windows_gnu.rs +++ b/compiler/rustc_target/src/spec/x86_64_uwp_windows_gnu.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, LldFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_uwp_gnu_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { .insert(LinkerFlavor::Lld(LldFlavor::Ld), vec!["-m".to_string(), "i386pep".to_string()]); base.max_atomic_width = Some(64); - Ok(Target { + Target { llvm_target: "x86_64-pc-windows-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "uwp".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/x86_64_uwp_windows_msvc.rs index 258df010aae..41beab91536 100644 --- a/compiler/rustc_target/src/spec/x86_64_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/x86_64_uwp_windows_msvc.rs @@ -1,12 +1,12 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::windows_uwp_msvc_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); base.has_elf_tls = true; - Ok(Target { + Target { llvm_target: "x86_64-pc-windows-msvc".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -19,5 +19,5 @@ pub fn target() -> TargetResult { target_vendor: "uwp".to_string(), linker_flavor: LinkerFlavor::Msvc, options: base, - }) + } } diff --git a/compiler/rustc_target/src/spec/x86_64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/x86_64_wrs_vxworks.rs index f1e27f4d8be..96927660a3c 100644 --- a/compiler/rustc_target/src/spec/x86_64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/x86_64_wrs_vxworks.rs @@ -1,6 +1,6 @@ -use crate::spec::{LinkerFlavor, Target, TargetResult}; +use crate::spec::{LinkerFlavor, Target}; -pub fn target() -> TargetResult { +pub fn target() -> Target { let mut base = super::vxworks_base::opts(); base.cpu = "x86-64".to_string(); base.max_atomic_width = Some(64); @@ -8,7 +8,7 @@ pub fn target() -> TargetResult { base.stack_probes = true; base.disable_redzone = true; - Ok(Target { + Target { llvm_target: "x86_64-unknown-linux-gnu".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -21,5 +21,5 @@ pub fn target() -> TargetResult { target_vendor: "wrs".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, - }) + } } From 1444ad7ba1c34685fecf7b0413403151aba51e9d Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 5 Oct 2020 16:24:04 +0300 Subject: [PATCH 2/2] rustc_target: Further simplify loading of built-in targets using the fact that it is infallible. JSON roundtrip check on every rustc run is also removed, it's already performed by unit tests. --- compiler/rustc_driver/src/lib.rs | 3 +- compiler/rustc_target/src/spec/mod.rs | 49 +++++++-------------------- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 3f50c68e3eb..23ed3918c8b 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -672,7 +672,8 @@ impl RustcDefaultCalls { for req in &sess.opts.prints { match *req { TargetList => { - let mut targets = rustc_target::spec::get_targets().collect::>(); + let mut targets = + rustc_target::spec::TARGETS.iter().copied().collect::>(); targets.sort(); println!("{}", targets.join("\n")); } diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 359f5d1fde8..f4f4b45c7ee 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -430,11 +430,6 @@ impl fmt::Display for LinkOutputKind { } } -pub enum LoadTargetError { - BuiltinTargetNotFound(String), - Other(String), -} - pub type LinkArgs = BTreeMap>; macro_rules! supported_targets { @@ -442,34 +437,16 @@ macro_rules! supported_targets { $(mod $module;)+ /// List of supported targets - const TARGETS: &[&str] = &[$($($triple),+),+]; + pub const TARGETS: &[&str] = &[$($($triple),+),+]; - fn load_specific(target: &str) -> Result { - match target { - $( - $($triple)|+ => { - let mut t = $module::target(); - t.options.is_builtin = true; - - // round-trip through the JSON parser to ensure at - // run-time that the parser works correctly - t = Target::from_json(t.to_json()) - .map_err(LoadTargetError::Other)?; - debug!("got builtin target: {:?}", t); - Ok(t) - }, - )+ - _ => Err(LoadTargetError::BuiltinTargetNotFound( - format!("Unable to find target: {}", target))) - } - } - - pub fn get_targets() -> impl Iterator { - TARGETS.iter().filter_map(|t| -> Option { - load_specific(t) - .and(Ok(t.to_string())) - .ok() - }) + fn load_builtin(target: &str) -> Option { + let mut t = match target { + $( $($triple)|+ => $module::target(), )+ + _ => return None, + }; + t.options.is_builtin = true; + debug!("got builtin target: {:?}", t); + Some(t) } #[cfg(test)] @@ -1529,11 +1506,9 @@ impl Target { match *target_triple { TargetTriple::TargetTriple(ref target_triple) => { - // check if triple is in list of supported targets - match load_specific(target_triple) { - Ok(t) => return Ok(t), - Err(LoadTargetError::BuiltinTargetNotFound(_)) => (), - Err(LoadTargetError::Other(e)) => return Err(e), + // check if triple is in list of built-in targets + if let Some(t) = load_builtin(target_triple) { + return Ok(t); } // search for a file named `target_triple`.json in RUST_TARGET_PATH