From 1a1f5b89a4acf44fc4720c097b4bbcebcfa26818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20BRANSTETT?= Date: Sun, 3 Apr 2022 18:42:39 +0200 Subject: [PATCH] Cleanup after some refactoring in rustc_target --- .../rustc_codegen_cranelift/src/driver/aot.rs | 8 +- compiler/rustc_codegen_gcc/src/lib.rs | 6 +- compiler/rustc_codegen_ssa/src/back/link.rs | 6 +- compiler/rustc_session/src/config.rs | 2 +- compiler/rustc_target/src/spec/apple_base.rs | 4 +- .../src/spec/armv6k_nintendo_3ds.rs | 4 +- .../rustc_target/src/spec/dragonfly_base.rs | 4 +- .../rustc_target/src/spec/freebsd_base.rs | 4 +- .../rustc_target/src/spec/fuchsia_base.rs | 6 +- compiler/rustc_target/src/spec/haiku_base.rs | 4 +- .../rustc_target/src/spec/illumos_base.rs | 5 +- compiler/rustc_target/src/spec/l4re_base.rs | 5 +- compiler/rustc_target/src/spec/linux_base.rs | 4 +- .../rustc_target/src/spec/mipsel_sony_psp.rs | 4 +- compiler/rustc_target/src/spec/mod.rs | 87 +++++++++---------- .../rustc_target/src/spec/msp430_none_elf.rs | 3 +- compiler/rustc_target/src/spec/netbsd_base.rs | 4 +- .../rustc_target/src/spec/openbsd_base.rs | 4 +- compiler/rustc_target/src/spec/redox_base.rs | 4 +- .../src/spec/riscv32imc_esp_espidf.rs | 4 +- .../rustc_target/src/spec/solaris_base.rs | 4 +- .../src/spec/thumbv4t_none_eabi.rs | 3 +- .../rustc_target/src/spec/vxworks_base.rs | 4 +- .../rustc_target/src/spec/windows_gnu_base.rs | 4 +- .../src/spec/windows_msvc_base.rs | 4 +- 25 files changed, 79 insertions(+), 112 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs index 2e047c7eea1..5e1e1c81d26 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs @@ -304,8 +304,12 @@ pub(crate) fn run_aot( }; // FIXME handle `-Ctarget-cpu=native` - let target_cpu = - tcx.sess.opts.cg.target_cpu.as_ref().unwrap_or(&tcx.sess.target.cpu).to_owned(); + let target_cpu = match tcx.sess.opts.cg.target_cpu { + Some(ref name) => name, + None => tcx.sess.target.cpu.as_ref(), + } + .to_owned(); + Box::new(( CodegenResults { modules, diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index eac4a06226c..497a28354d8 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -287,8 +287,10 @@ fn handle_native(name: &str) -> &str { } pub fn target_cpu(sess: &Session) -> &str { - let name = sess.opts.cg.target_cpu.as_ref().unwrap_or(&sess.target.cpu); - handle_native(name) + match sess.opts.cg.target_cpu { + Some(ref name) => handle_native(name), + None => handle_native(sess.target.cpu.as_ref()), + } } pub fn target_features(sess: &Session) -> Vec { diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 40fe3c86e43..84a1043a6a0 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -675,10 +675,10 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( linker::disable_localization(&mut cmd); - for &(ref k, ref v) in sess.target.link_env.iter() { + for &(ref k, ref v) in sess.target.link_env.as_ref() { cmd.env(k.as_ref(), v.as_ref()); } - for k in sess.target.link_env_remove.iter() { + for k in sess.target.link_env_remove.as_ref() { cmd.env_remove(k.as_ref()); } @@ -1217,7 +1217,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { if let Some(ret) = infer_from( sess, - sess.target.linker.as_ref().map(|l| PathBuf::from(l.as_ref())), + sess.target.linker.as_deref().map(PathBuf::from), Some(sess.target.linker_flavor), ) { return ret; diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 408fd4ed2e6..4182a5d0711 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -956,7 +956,7 @@ fn default_configuration(sess: &Session) -> CrateConfig { ret.reserve(7); // the minimum number of insertions // Target bindings. ret.insert((sym::target_os, Some(Symbol::intern(os)))); - for fam in sess.target.families.iter() { + for fam in sess.target.families.as_ref() { ret.insert((sym::target_family, Some(Symbol::intern(fam)))); if fam == "windows" { ret.insert((sym::windows, None)); diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs index f2cef7996ff..238d3f8bda5 100644 --- a/compiler/rustc_target/src/spec/apple_base.rs +++ b/compiler/rustc_target/src/spec/apple_base.rs @@ -1,8 +1,6 @@ use std::{borrow::Cow, env}; -use crate::spec::{FramePointer, LldFlavor, SplitDebuginfo, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, FramePointer, LldFlavor, SplitDebuginfo, TargetOptions}; pub fn opts(os: &'static str) -> TargetOptions { // ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6 diff --git a/compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs b/compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs index 2e050b44156..ffcd1a3f4df 100644 --- a/compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs +++ b/compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs @@ -1,6 +1,4 @@ -use crate::spec::{LinkArgs, LinkerFlavor, RelocModel, Target, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, LinkArgs, LinkerFlavor, RelocModel, Target, TargetOptions}; /// A base target for Nintendo 3DS devices using the devkitARM toolchain. /// diff --git a/compiler/rustc_target/src/spec/dragonfly_base.rs b/compiler/rustc_target/src/spec/dragonfly_base.rs index 43072d63894..b59322d07f5 100644 --- a/compiler/rustc_target/src/spec/dragonfly_base.rs +++ b/compiler/rustc_target/src/spec/dragonfly_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/freebsd_base.rs b/compiler/rustc_target/src/spec/freebsd_base.rs index 05d60574f32..a7e0f9f7041 100644 --- a/compiler/rustc_target/src/spec/freebsd_base.rs +++ b/compiler/rustc_target/src/spec/freebsd_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/fuchsia_base.rs b/compiler/rustc_target/src/spec/fuchsia_base.rs index 2ee7047d7e0..04e30ff0c3e 100644 --- a/compiler/rustc_target/src/spec/fuchsia_base.rs +++ b/compiler/rustc_target/src/spec/fuchsia_base.rs @@ -1,6 +1,6 @@ -use crate::spec::{crt_objects, LinkArgs, LinkOutputKind, LinkerFlavor, LldFlavor, TargetOptions}; - -use super::cvs; +use crate::spec::{ + crt_objects, cvs, LinkArgs, LinkOutputKind, LinkerFlavor, LldFlavor, TargetOptions, +}; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/compiler/rustc_target/src/spec/haiku_base.rs b/compiler/rustc_target/src/spec/haiku_base.rs index 25549491f4b..61c05a2bdb6 100644 --- a/compiler/rustc_target/src/spec/haiku_base.rs +++ b/compiler/rustc_target/src/spec/haiku_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/illumos_base.rs b/compiler/rustc_target/src/spec/illumos_base.rs index 1f6202dd7f5..ef8f90a4da8 100644 --- a/compiler/rustc_target/src/spec/illumos_base.rs +++ b/compiler/rustc_target/src/spec/illumos_base.rs @@ -1,7 +1,4 @@ -use crate::spec::{FramePointer, LinkArgs, LinkerFlavor, TargetOptions}; -use std::default::Default; - -use super::cvs; +use crate::spec::{cvs, FramePointer, LinkArgs, LinkerFlavor, TargetOptions}; pub fn opts() -> TargetOptions { let mut late_link_args = LinkArgs::new(); diff --git a/compiler/rustc_target/src/spec/l4re_base.rs b/compiler/rustc_target/src/spec/l4re_base.rs index e185de78bca..7a051532f82 100644 --- a/compiler/rustc_target/src/spec/l4re_base.rs +++ b/compiler/rustc_target/src/spec/l4re_base.rs @@ -1,7 +1,4 @@ -use crate::spec::{LinkerFlavor, PanicStrategy, TargetOptions}; -use std::default::Default; - -use super::cvs; +use crate::spec::{cvs, LinkerFlavor, PanicStrategy, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/linux_base.rs b/compiler/rustc_target/src/spec/linux_base.rs index 84d8e19159a..0f79ada0d93 100644 --- a/compiler/rustc_target/src/spec/linux_base.rs +++ b/compiler/rustc_target/src/spec/linux_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/mipsel_sony_psp.rs b/compiler/rustc_target/src/spec/mipsel_sony_psp.rs index dc8169b7118..45966b97d6a 100644 --- a/compiler/rustc_target/src/spec/mipsel_sony_psp.rs +++ b/compiler/rustc_target/src/spec/mipsel_sony_psp.rs @@ -1,7 +1,5 @@ +use crate::spec::{cvs, Target, TargetOptions}; use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, RelocModel}; -use crate::spec::{Target, TargetOptions}; - -use super::cvs; // The PSP has custom linker requirements. const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld"); diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 96623e1c163..bd5b712c143 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -459,7 +459,7 @@ impl fmt::Display for LinkOutputKind { } } -pub type LinkArgs = BTreeMap>>; +pub type LinkArgs = BTreeMap>>; #[derive(Clone, Copy, Hash, Debug, PartialEq, Eq)] pub enum SplitDebuginfo { @@ -1028,19 +1028,16 @@ supported_targets! { } /// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]> -// FIXME(Urgau): Figure out why the obvious form `["".into()].into()` doesn't work. macro_rules! cvs { () => { ::std::borrow::Cow::Borrowed(&[]) }; ($($x:expr),+ $(,)?) => { - { - ::std::borrow::Cow::Borrowed(&[ - $( - ::std::borrow::Cow::Borrowed($x), - )* - ]) - } + ::std::borrow::Cow::Borrowed(&[ + $( + ::std::borrow::Cow::Borrowed($x), + )* + ]) }; } @@ -1084,14 +1081,14 @@ impl TargetWarnings { #[derive(PartialEq, Clone, Debug)] pub struct Target { /// Target triple to pass to LLVM. - pub llvm_target: Cow<'static, str>, + pub llvm_target: StaticCow, /// Number of bits in a pointer. Influences the `target_pointer_width` `cfg` variable. pub pointer_width: u32, /// Architecture to use for ABI considerations. Valid options include: "x86", /// "x86_64", "arm", "aarch64", "mips", "powerpc", "powerpc64", and others. - pub arch: Cow<'static, str>, + pub arch: StaticCow, /// [Data layout](https://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM. - pub data_layout: Cow<'static, str>, + pub data_layout: StaticCow, /// Optional settings with defaults. pub options: TargetOptions, } @@ -1107,6 +1104,8 @@ impl HasTargetSpec for Target { } } +type StaticCow = Cow<'static, T>; + /// Optional aspects of a target specification. /// /// This has an implementation of `Default`, see each field for what the default is. In general, @@ -1123,25 +1122,25 @@ pub struct TargetOptions { /// Used as the `target_endian` `cfg` variable. Defaults to little endian. pub endian: Endian, /// Width of c_int type. Defaults to "32". - pub c_int_width: Cow<'static, str>, + pub c_int_width: StaticCow, /// OS name to use for conditional compilation (`target_os`). Defaults to "none". /// "none" implies a bare metal target without `std` library. /// A couple of targets having `std` also use "unknown" as an `os` value, /// but they are exceptions. - pub os: Cow<'static, str>, + pub os: StaticCow, /// Environment name to use for conditional compilation (`target_env`). Defaults to "". - pub env: Cow<'static, str>, + pub env: StaticCow, /// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"` /// or `"eabihf"`. Defaults to "". - pub abi: Cow<'static, str>, + pub abi: StaticCow, /// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown". - pub vendor: Cow<'static, str>, + pub vendor: StaticCow, /// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed /// on the command line. Defaults to `LinkerFlavor::Gcc`. pub linker_flavor: LinkerFlavor, /// Linker to invoke - pub linker: Option>, + pub linker: Option>, /// LLD flavor used if `lld` (or `rust-lld`) is specified as a linker /// without clarifying its flavor in any way. @@ -1176,23 +1175,23 @@ pub struct TargetOptions { /// Optional link script applied to `dylib` and `executable` crate types. /// This is a string containing the script, not a path. Can only be applied /// to linkers where `linker_is_gnu` is true. - pub link_script: Option>, + pub link_script: Option>, /// Environment variables to be set for the linker invocation. - pub link_env: Cow<'static, [(Cow<'static, str>, Cow<'static, str>)]>, + pub link_env: StaticCow<[(StaticCow, StaticCow)]>, /// Environment variables to be removed for the linker invocation. - pub link_env_remove: Cow<'static, [Cow<'static, str>]>, + pub link_env_remove: StaticCow<[StaticCow]>, /// Extra arguments to pass to the external assembler (when used) - pub asm_args: Cow<'static, [Cow<'static, str>]>, + pub asm_args: StaticCow<[StaticCow]>, /// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults /// to "generic". - pub cpu: Cow<'static, str>, + pub cpu: StaticCow, /// Default target features to pass to LLVM. These features will *always* be /// passed, and cannot be disabled even via `-C`. Corresponds to `llc /// -mattr=$features`. - pub features: Cow<'static, str>, + pub features: StaticCow, /// Whether dynamic linking is available on this target. Defaults to false. pub dynamic_linking: bool, /// If dynamic linking is available, whether only cdylibs are supported. @@ -1216,21 +1215,21 @@ pub struct TargetOptions { /// Emit each function in its own section. Defaults to true. pub function_sections: bool, /// String to prepend to the name of every dynamic library. Defaults to "lib". - pub dll_prefix: Cow<'static, str>, + pub dll_prefix: StaticCow, /// String to append to the name of every dynamic library. Defaults to ".so". - pub dll_suffix: Cow<'static, str>, + pub dll_suffix: StaticCow, /// String to append to the name of every executable. - pub exe_suffix: Cow<'static, str>, + pub exe_suffix: StaticCow, /// String to prepend to the name of every static library. Defaults to "lib". - pub staticlib_prefix: Cow<'static, str>, + pub staticlib_prefix: StaticCow, /// String to append to the name of every static library. Defaults to ".a". - pub staticlib_suffix: Cow<'static, str>, + pub staticlib_suffix: StaticCow, /// Values of the `target_family` cfg set for this target. /// /// Common options are: "unix", "windows". Defaults to no families. /// /// See . - pub families: Cow<'static, [Cow<'static, str>]>, + pub families: StaticCow<[StaticCow]>, /// Whether the target toolchain's ABI supports returning small structs as an integer. pub abi_return_struct_as_int: bool, /// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS, @@ -1302,7 +1301,7 @@ pub struct TargetOptions { /// LLVM to assemble an archive or fall back to the system linker, and /// currently only "gnu" is used to fall into LLVM. Unknown strings cause /// the system linker to be used. - pub archive_format: Cow<'static, str>, + pub archive_format: StaticCow, /// Is asm!() allowed? Defaults to true. pub allow_asm: bool, /// Whether the runtime startup code requires the `main` function be passed @@ -1318,7 +1317,7 @@ pub struct TargetOptions { /// Whether the target requires that emitted object code includes bitcode. pub forces_embed_bitcode: bool, /// Content of the LLVM cmdline section associated with embedded bitcode. - pub bitcode_llvm_cmdline: Cow<'static, str>, + pub bitcode_llvm_cmdline: StaticCow, /// Don't use this field; instead use the `.min_atomic_width()` method. pub min_atomic_width: Option, @@ -1390,7 +1389,7 @@ pub struct TargetOptions { /// If set, have the linker export exactly these symbols, instead of using /// the usual logic to figure this out from the crate itself. - pub override_export_symbols: Option]>>, + pub override_export_symbols: Option]>>, /// Determines how or whether the MergeFunctions LLVM pass should run for /// this target. Either "disabled", "trampolines", or "aliases". @@ -1401,16 +1400,16 @@ pub struct TargetOptions { pub merge_functions: MergeFunctions, /// Use platform dependent mcount function - pub mcount: Cow<'static, str>, + pub mcount: StaticCow, /// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers - pub llvm_abiname: Cow<'static, str>, + pub llvm_abiname: StaticCow, /// Whether or not RelaxElfRelocation flag will be passed to the linker pub relax_elf_relocations: bool, /// Additional arguments to pass to LLVM, similar to the `-C llvm-args` codegen option. - pub llvm_args: Cow<'static, [Cow<'static, str>]>, + pub llvm_args: StaticCow<[StaticCow]>, /// Whether to use legacy .ctors initialization hooks rather than .init_array. Defaults /// to false (uses .init_array). @@ -1459,8 +1458,8 @@ impl Default for TargetOptions { endian: Endian::Little, c_int_width: "32".into(), os: "none".into(), - env: Cow::from(""), - abi: Cow::from(""), + env: "".into(), + abi: "".into(), vendor: "unknown".into(), linker_flavor: LinkerFlavor::Gcc, linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()), @@ -1468,9 +1467,9 @@ impl Default for TargetOptions { pre_link_args: LinkArgs::new(), post_link_args: LinkArgs::new(), link_script: None, - asm_args: Cow::Borrowed(&[]), + asm_args: cvs![], cpu: "generic".into(), - features: Cow::from(""), + features: "".into(), dynamic_linking: false, only_cdylib: false, executables: false, @@ -1482,7 +1481,7 @@ impl Default for TargetOptions { function_sections: true, dll_prefix: "lib".into(), dll_suffix: ".so".into(), - exe_suffix: Cow::from(""), + exe_suffix: "".into(), staticlib_prefix: "lib".into(), staticlib_suffix: ".a".into(), families: cvs![], @@ -1511,15 +1510,15 @@ impl Default for TargetOptions { late_link_args: LinkArgs::new(), late_link_args_dynamic: LinkArgs::new(), late_link_args_static: LinkArgs::new(), - link_env: Cow::Borrowed(&[]), - link_env_remove: Cow::Borrowed(&[]), + link_env: cvs![], + link_env_remove: cvs![], archive_format: "gnu".into(), main_needs_argc_argv: true, allow_asm: true, has_thread_local: false, obj_is_bitcode: false, forces_embed_bitcode: false, - bitcode_llvm_cmdline: Cow::from(""), + bitcode_llvm_cmdline: "".into(), min_atomic_width: None, max_atomic_width: None, atomic_cas: true, diff --git a/compiler/rustc_target/src/spec/msp430_none_elf.rs b/compiler/rustc_target/src/spec/msp430_none_elf.rs index f22c8672639..cedacb60f31 100644 --- a/compiler/rustc_target/src/spec/msp430_none_elf.rs +++ b/compiler/rustc_target/src/spec/msp430_none_elf.rs @@ -1,5 +1,4 @@ -use super::cvs; -use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions}; +use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/netbsd_base.rs b/compiler/rustc_target/src/spec/netbsd_base.rs index a5fb58f5e7b..69016d77cf9 100644 --- a/compiler/rustc_target/src/spec/netbsd_base.rs +++ b/compiler/rustc_target/src/spec/netbsd_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/openbsd_base.rs b/compiler/rustc_target/src/spec/openbsd_base.rs index 7745d10e13e..bbd322bb6ce 100644 --- a/compiler/rustc_target/src/spec/openbsd_base.rs +++ b/compiler/rustc_target/src/spec/openbsd_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{FramePointer, RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, FramePointer, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/redox_base.rs b/compiler/rustc_target/src/spec/redox_base.rs index 667aa8e9c94..1878cc3fc11 100644 --- a/compiler/rustc_target/src/spec/redox_base.rs +++ b/compiler/rustc_target/src/spec/redox_base.rs @@ -1,6 +1,4 @@ -use crate::spec::{RelroLevel, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/riscv32imc_esp_espidf.rs b/compiler/rustc_target/src/spec/riscv32imc_esp_espidf.rs index 4c7401380fd..0200862c7e0 100644 --- a/compiler/rustc_target/src/spec/riscv32imc_esp_espidf.rs +++ b/compiler/rustc_target/src/spec/riscv32imc_esp_espidf.rs @@ -1,7 +1,5 @@ +use crate::spec::{cvs, Target, TargetOptions}; use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions}; - -use super::cvs; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/solaris_base.rs b/compiler/rustc_target/src/spec/solaris_base.rs index 8d8ad049b33..d61e1b2ec10 100644 --- a/compiler/rustc_target/src/spec/solaris_base.rs +++ b/compiler/rustc_target/src/spec/solaris_base.rs @@ -1,6 +1,4 @@ -use crate::spec::TargetOptions; - -use super::cvs; +use crate::spec::{cvs, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs index 457b78850ac..8d6130a8a79 100644 --- a/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs @@ -8,8 +8,7 @@ //! //! **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 super::cvs; -use crate::spec::{LinkerFlavor, Target, TargetOptions}; +use crate::spec::{cvs, LinkerFlavor, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/vxworks_base.rs b/compiler/rustc_target/src/spec/vxworks_base.rs index f43cea131b7..2beb279e398 100644 --- a/compiler/rustc_target/src/spec/vxworks_base.rs +++ b/compiler/rustc_target/src/spec/vxworks_base.rs @@ -1,6 +1,4 @@ -use crate::spec::TargetOptions; - -use super::cvs; +use crate::spec::{cvs, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { diff --git a/compiler/rustc_target/src/spec/windows_gnu_base.rs b/compiler/rustc_target/src/spec/windows_gnu_base.rs index 1e5ced684bd..d11f1f7d3f8 100644 --- a/compiler/rustc_target/src/spec/windows_gnu_base.rs +++ b/compiler/rustc_target/src/spec/windows_gnu_base.rs @@ -1,7 +1,5 @@ use crate::spec::crt_objects::{self, CrtObjectsFallback}; -use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; - -use super::cvs; +use crate::spec::{cvs, LinkArgs, LinkerFlavor, LldFlavor, TargetOptions}; pub fn opts() -> TargetOptions { let mut pre_link_args = LinkArgs::new(); diff --git a/compiler/rustc_target/src/spec/windows_msvc_base.rs b/compiler/rustc_target/src/spec/windows_msvc_base.rs index bfe8edecac4..21062c337d8 100644 --- a/compiler/rustc_target/src/spec/windows_msvc_base.rs +++ b/compiler/rustc_target/src/spec/windows_msvc_base.rs @@ -1,6 +1,4 @@ -use crate::spec::TargetOptions; - -use super::cvs; +use crate::spec::{cvs, TargetOptions}; pub fn opts() -> TargetOptions { let base = super::msvc_base::opts();