From 021fcbd90cebe83bb2f0298f2e7001605b5a97d7 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 5 Oct 2020 15:37:55 +0300 Subject: [PATCH] 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 60daf10b36afe..b24518beae2c0 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 168cd01878e52..ab20ec041ab57 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 5e2cab0df1e55..4619197fc6969 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 aabfe458ca3b6..beb2a0912e6db 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 e4ecc7ac2dc80..519fd98d2007c 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 8c03f1e8a7eab..09df41d33604d 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 1278b89c7fde2..cecf3860fa5d5 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 5ae592c5139c8..78e9f990de2ee 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 e07b8f7a75655..c0532925fb9a6 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 036162248c76e..67ee463c1780c 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 dc613f35d1d31..cb566c84ed7ab 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 8c2f6fcff7304..d6990f7430f8e 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 e012dce73fecb..fd45acb332a8c 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 e2aa6e3b8f52c..666f417036efc 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 fd726c70f496b..2b7dbc0ebdbcf 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 f347a2dba53f3..5f151473e0f8b 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 6a8d148259ac3..7dfcc1c065f76 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 05f5d7d3a8b47..fc2d192ef1263 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 7109d043f519c..7ea0080056232 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 2e3bad83e2559..0573cf5ba9ded 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 f8e357cce6636..dbd68e366a1aa 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 75753af9f3078..cd5c181ec61cc 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 c74c88e36125f..2b99cd01e59f7 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 e0d1f2653ce0b..c414810dab20d 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 e2d37d45bf147..608095db1971e 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 2580e8b0f8515..74a084546216b 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 f28421dc77593..08bd221bcc8d8 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 fe1fa88883d3e..bb8ed6d1d9da7 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 1e06f837997a1..902dac30b51b1 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 ef40085888c81..7f611defe90cd 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 6dafcc2c3453a..ac24e872a9a7a 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 38c6c31bd10da..ebaef615ac390 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 e3f4fe0b2efb6..5a1391ccedd08 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 80a9e6d7e3c80..08d7d268148e8 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 0f175e9aef5e8..02abd02f3b2fb 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 27923457cd16e..d63c728fe4b07 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 3d1bf05237fd9..93a004fa002d9 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 03d7d88b0d6d0..93a87ff44ef74 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 18fc9ed2ec638..c3a2324130cde 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 04d8702471af5..4d95a2792189e 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 1db279defff39..dfd60601f4d9f 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 22c2b306b43bb..340d9788d23d7 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 fed83997190a7..a3994e72490de 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 769ac13e51506..3248679dc45ba 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 d6c99c4ade6e8..54f1b1a2ac29e 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 d3dbc39c99d2b..1c3f5c4f9e8fd 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 527a322d56a4f..83a048b06ba50 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 5d22598b57b87..7e63ae9c5aa26 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 0976acb4fb05d..65b305aa84bd8 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 6cb209ab1c073..4f6b8b25842d8 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 ba712aced8474..664b9d5d51589 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 49f4f2cb6b999..3276f1d0094f8 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 0f2ccebd6dace..5fbf048722691 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 b7a34f9740ac4..62a0e415094c2 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 79242f240269c..529e0d392909c 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 33c9008bb1405..64a975ee1bc5b 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 9d0922b8ce5a9..2de1f07844e4b 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 729b1f68e005c..6cd34f38c5774 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 60f2188514e1b..691820a301036 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 4dc27af30dadb..cfc3a74104bc8 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 0d578f22f9825..1e0efca8eed77 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 699a0ab45e872..6e4259176cf1f 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 88b1ae7d53c08..7305578ab6aff 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 829cd1ac1a397..f5b292685fa2d 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 221d5f0785cd2..bb3b0b70744dd 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 1c6d2e061bc03..100e0706bc11d 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 ed2dba53589ed..d4426a4eb9ea5 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 f5f66cabb2cfd..8320beefb275d 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 b2ea8a6f38814..f20d337931eff 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 17584de1144cf..edddcd616bfc9 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 48aea4a39b0a4..031c5229f7e2b 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 c7a849a164144..d76d0d3930b89 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 e360abdb38d3f..ebead1ce64f17 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 c8d97e600d450..0042244569a05 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 8116b8c9cc840..bdb9be4a02764 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 b3bda97c8a570..5d8ad510d6047 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 7e9d8cd942a23..ef585a4bc3716 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 f70cc13224fff..3552abd0968e9 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 a8152011efa79..b52ae5cc01629 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 36b83c63fca28..10ec589ef2069 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 717ae3f1d20e1..8157cac41701a 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 3f7d233e55fbc..e5d565f653c0b 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 4f41b8323a99a..5f68c6484c0c2 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 f1e8330425e25..359f5d1fde891 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 f75697996ac78..9274d750c7c2c 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 0c8f2a34301ee..e44534a288d7e 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 60c15d6b7d2e9..ab889387e2b96 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 5306d905c5d7b..84a19e8a0472f 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 c3b956effaead..c320d10e6c1df 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 e00a927c3a4bd..257a093208058 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 90737994612d4..5d501f840b638 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 1a1fccfab0265..847e8abf29966 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 2d4c5986637b2..5f55a233fc428 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 fabc4313bee42..b3c3a2fe2429f 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 240cbcbfe6ebf..804f223ba6eab 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 6ca7053ced56c..5be35dbdc8903 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 2211dc29a5dfc..44338c066e647 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 b10182c09adfe..e2dc7858d2cfc 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 28710c60175b0..bce690662b8ab 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 5b5e342000b55..83e27c4d83852 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 4cef5c42d8ddf..e2154f58494cb 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 8ad563e441de3..845a80a06c777 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 f7a93c916d1d5..2cd3b95261827 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 3aeb3f3ca72b2..1f857159f0ce5 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 d8144964dc913..c407fd9557d0b 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 f259787e1d54d..ed1c96f1d7bd0 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 c842b22d4e16e..8b540a717ceda 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 aad85e852f08f..cfdc43547ffef 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 229e0621e0dc1..6f2eaeee32a29 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 162cd311a3826..ea02db7e5bb2f 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 acc03fd0d79ee..747f70e65c55c 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 b2c2b8254d8f0..d06ab368e1caa 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 a8c78f057fc8a..1a58a9111f0a9 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 953d60fcc224d..bd1367ddb4230 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 37828026fe113..01a3598572dc9 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 29a4a9875e5b0..af4741c77ab15 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 9e085381953c9..10e1050fbf5cc 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 95b9b9d5b566e..17a5b70bc0926 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 528359ffad386..c21cb5d03d489 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 c52f077f6f16c..8c4750d773122 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 78936948e642e..85bdc16727b98 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 f759c3eeb011c..b97b5270d4235 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 3f67c67b7bcc1..9eb33f5ef6637 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 2f8103f0c7034..55b8b545e7979 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 53a340230d62c..f17d48e85239c 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 1916639170e88..4f99967f21bf7 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 ded95a34d55d4..f0b6979ce110e 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 351167105ec7a..f8fdbf44b19d5 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 909aebec70b58..45e8ddd6137cb 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 fd3e4e2f57b66..b4590f7aed253 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 4cfbd9eba06c7..85cc4e6db6fe1 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 664a3ed8816c4..db46640056224 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 3b5233a3e677d..cc27d88bff1d8 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 37b6d57366cf5..887b3b67edd37 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 74097f5bf6f5e..44c869d1e3005 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 65bb97d84aae9..b9507ad9c8ec3 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 99af483f1d415..e93755d1aa486 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 75ff6b97a2e1e..ffb0eb43bebcf 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 fbade02c55690..3d97f4315ec90 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 53f4df9651819..5c6be285360ff 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 dbc5f965020e9..c002671552f7d 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 fd1871b1a57c3..1390926ed3ff3 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 a124f582bf3fc..424f0343ec913 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 51237697714a4..2f9be167b9b66 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 4a526f90ed5bc..0da92f035a5fa 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 c25cd0809eed8..ea955e758bbf6 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 2567ca47ef967..482748f5b3d57 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 cab19f149a77c..65e080d306682 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 29cbb777db5d7..66df76cad6982 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 0a37399e2fac3..81dae46b8a364 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 3a22290da6858..e513df790be78 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 adf09c89c426b..9c984f169a646 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 dbd163db36b45..d9110c882c1c0 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 3d40bafbe1fd4..42af9c799bd95 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 849227a574aeb..17d75a9671366 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 3bd18f23f6f88..b288271406c14 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 258df010aae0c..41beab915362a 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 f1e27f4d8beaf..96927660a3c57 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, - }) + } }