diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:13:50 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:26:52 +1000 |
| commit | 84ac80f1921afc243d71fd0caaa4f2838c294102 (patch) | |
| tree | 29006db815bf547dfd0129910b23b8c54675bd98 /compiler/rustc_target | |
| parent | 118f9350c5b902e462a6dcc4325670f3da701600 (diff) | |
| download | rust-84ac80f1921afc243d71fd0caaa4f2838c294102.tar.gz rust-84ac80f1921afc243d71fd0caaa4f2838c294102.zip | |
Reformat `use` declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
Diffstat (limited to 'compiler/rustc_target')
56 files changed, 181 insertions, 133 deletions
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index 9f13c195e4c..c03f61378c5 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -1,11 +1,12 @@ -use crate::abi::{self, Abi, Align, FieldsShape, Size}; -use crate::abi::{HasDataLayout, TyAbiInterface, TyAndLayout}; -use crate::spec::{self, HasTargetSpec, HasWasmCAbiOpt, WasmCAbi}; -use rustc_macros::HashStable_Generic; -use rustc_span::Symbol; use std::fmt; use std::str::FromStr; +use rustc_macros::HashStable_Generic; +use rustc_span::Symbol; + +use crate::abi::{self, Abi, Align, FieldsShape, HasDataLayout, Size, TyAbiInterface, TyAndLayout}; +use crate::spec::{self, HasTargetSpec, HasWasmCAbiOpt, WasmCAbi}; + mod aarch64; mod amdgpu; mod arm; @@ -967,8 +968,9 @@ impl FromStr for Conv { // Some types are used a lot. Make sure they don't unintentionally get bigger. #[cfg(target_pointer_width = "64")] mod size_asserts { - use super::*; use rustc_data_structures::static_assert_size; + + use super::*; // tidy-alphabetical-start static_assert_size!(ArgAbi<'_, usize>, 56); static_assert_size!(FnAbi<'_, usize>, 80); diff --git a/compiler/rustc_target/src/abi/call/nvptx64.rs b/compiler/rustc_target/src/abi/call/nvptx64.rs index ac68e8879f6..27d197af792 100644 --- a/compiler/rustc_target/src/abi/call/nvptx64.rs +++ b/compiler/rustc_target/src/abi/call/nvptx64.rs @@ -1,8 +1,7 @@ +use super::{ArgAttribute, ArgAttributes, ArgExtension, CastTarget}; use crate::abi::call::{ArgAbi, FnAbi, PassMode, Reg, Size, Uniform}; use crate::abi::{HasDataLayout, TyAbiInterface}; -use super::{ArgAttribute, ArgAttributes, ArgExtension, CastTarget}; - fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) { if ret.layout.is_aggregate() && ret.layout.is_sized() { classify_aggregate(ret) diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index 737e9a8eab0..9bd0aff1d3b 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -1,15 +1,14 @@ +use std::fmt; +use std::ops::Deref; + use rustc_data_structures::intern::Interned; +use rustc_macros::HashStable_Generic; pub use Float::*; pub use Integer::*; pub use Primitive::*; use crate::json::{Json, ToJson}; -use std::fmt; -use std::ops::Deref; - -use rustc_macros::HashStable_Generic; - pub mod call; // Explicitly import `Float` to avoid ambiguity with `Primitive::Float`. diff --git a/compiler/rustc_target/src/asm/aarch64.rs b/compiler/rustc_target/src/asm/aarch64.rs index 1a3218da1af..358efb4174d 100644 --- a/compiler/rustc_target/src/asm/aarch64.rs +++ b/compiler/rustc_target/src/asm/aarch64.rs @@ -1,8 +1,10 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use crate::spec::{RelocModel, Target}; +use std::fmt; + use rustc_data_structures::fx::FxIndexSet; use rustc_span::Symbol; -use std::fmt; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; +use crate::spec::{RelocModel, Target}; def_reg_class! { AArch64 AArch64InlineAsmRegClass { diff --git a/compiler/rustc_target/src/asm/arm.rs b/compiler/rustc_target/src/asm/arm.rs index 70fcaab1847..f8d0d40e8a7 100644 --- a/compiler/rustc_target/src/asm/arm.rs +++ b/compiler/rustc_target/src/asm/arm.rs @@ -1,8 +1,10 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use crate::spec::{RelocModel, Target}; +use std::fmt; + use rustc_data_structures::fx::FxIndexSet; use rustc_span::{sym, Symbol}; -use std::fmt; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; +use crate::spec::{RelocModel, Target}; def_reg_class! { Arm ArmInlineAsmRegClass { diff --git a/compiler/rustc_target/src/asm/avr.rs b/compiler/rustc_target/src/asm/avr.rs index 6943fd9b5d7..276f376b297 100644 --- a/compiler/rustc_target/src/asm/avr.rs +++ b/compiler/rustc_target/src/asm/avr.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Avr AvrInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/bpf.rs b/compiler/rustc_target/src/asm/bpf.rs index faaeabb3c90..500fb4173e4 100644 --- a/compiler/rustc_target/src/asm/bpf.rs +++ b/compiler/rustc_target/src/asm/bpf.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Bpf BpfInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/csky.rs b/compiler/rustc_target/src/asm/csky.rs index db6cdecfe19..a4913ed76ab 100644 --- a/compiler/rustc_target/src/asm/csky.rs +++ b/compiler/rustc_target/src/asm/csky.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { CSKY CSKYInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/hexagon.rs b/compiler/rustc_target/src/asm/hexagon.rs index 7a809efee6f..f7e726c3376 100644 --- a/compiler/rustc_target/src/asm/hexagon.rs +++ b/compiler/rustc_target/src/asm/hexagon.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Hexagon HexagonInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/loongarch.rs b/compiler/rustc_target/src/asm/loongarch.rs index 534b696f7ed..b1c01d27cad 100644 --- a/compiler/rustc_target/src/asm/loongarch.rs +++ b/compiler/rustc_target/src/asm/loongarch.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { LoongArch LoongArchInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/m68k.rs b/compiler/rustc_target/src/asm/m68k.rs index ea367e3d2f9..680404bf355 100644 --- a/compiler/rustc_target/src/asm/m68k.rs +++ b/compiler/rustc_target/src/asm/m68k.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { M68k M68kInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/mips.rs b/compiler/rustc_target/src/asm/mips.rs index f0d659c9b97..e28b8453b47 100644 --- a/compiler/rustc_target/src/asm/mips.rs +++ b/compiler/rustc_target/src/asm/mips.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Mips MipsInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index b057bf94a08..4d8c5cea8a8 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -1,10 +1,12 @@ -use crate::spec::Target; -use crate::{abi::Size, spec::RelocModel}; +use std::fmt; +use std::str::FromStr; + use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; use rustc_span::Symbol; -use std::fmt; -use std::str::FromStr; + +use crate::abi::Size; +use crate::spec::{RelocModel, Target}; pub struct ModifierInfo { pub modifier: char, diff --git a/compiler/rustc_target/src/asm/msp430.rs b/compiler/rustc_target/src/asm/msp430.rs index 14013cd8a7b..5ed2023e384 100644 --- a/compiler/rustc_target/src/asm/msp430.rs +++ b/compiler/rustc_target/src/asm/msp430.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Msp430 Msp430InlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/nvptx.rs b/compiler/rustc_target/src/asm/nvptx.rs index 6c066ad7ac8..da8b79d8935 100644 --- a/compiler/rustc_target/src/asm/nvptx.rs +++ b/compiler/rustc_target/src/asm/nvptx.rs @@ -1,6 +1,7 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use rustc_span::Symbol; +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Nvptx NvptxInlineAsmRegClass { reg16, diff --git a/compiler/rustc_target/src/asm/powerpc.rs b/compiler/rustc_target/src/asm/powerpc.rs index 45e9ace0f29..b2416466132 100644 --- a/compiler/rustc_target/src/asm/powerpc.rs +++ b/compiler/rustc_target/src/asm/powerpc.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { PowerPC PowerPCInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/riscv.rs b/compiler/rustc_target/src/asm/riscv.rs index 02a4a5e2ece..2b9d6114930 100644 --- a/compiler/rustc_target/src/asm/riscv.rs +++ b/compiler/rustc_target/src/asm/riscv.rs @@ -1,8 +1,10 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use crate::spec::{RelocModel, Target}; +use std::fmt; + use rustc_data_structures::fx::FxIndexSet; use rustc_span::{sym, Symbol}; -use std::fmt; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; +use crate::spec::{RelocModel, Target}; def_reg_class! { RiscV RiscVInlineAsmRegClass { diff --git a/compiler/rustc_target/src/asm/s390x.rs b/compiler/rustc_target/src/asm/s390x.rs index 2bab41cd8a1..4258b23ac57 100644 --- a/compiler/rustc_target/src/asm/s390x.rs +++ b/compiler/rustc_target/src/asm/s390x.rs @@ -1,7 +1,9 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use rustc_span::Symbol; use std::fmt; +use rustc_span::Symbol; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { S390x S390xInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/spirv.rs b/compiler/rustc_target/src/asm/spirv.rs index f242faec026..c050c4e36b7 100644 --- a/compiler/rustc_target/src/asm/spirv.rs +++ b/compiler/rustc_target/src/asm/spirv.rs @@ -1,6 +1,7 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use rustc_span::Symbol; +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { SpirV SpirVInlineAsmRegClass { reg, diff --git a/compiler/rustc_target/src/asm/wasm.rs b/compiler/rustc_target/src/asm/wasm.rs index b5f4d10fb2b..0fbfa527bc4 100644 --- a/compiler/rustc_target/src/asm/wasm.rs +++ b/compiler/rustc_target/src/asm/wasm.rs @@ -1,6 +1,7 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use rustc_span::Symbol; +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; + def_reg_class! { Wasm WasmInlineAsmRegClass { local, diff --git a/compiler/rustc_target/src/asm/x86.rs b/compiler/rustc_target/src/asm/x86.rs index 8452961c17c..15c1925bcda 100644 --- a/compiler/rustc_target/src/asm/x86.rs +++ b/compiler/rustc_target/src/asm/x86.rs @@ -1,8 +1,10 @@ -use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; -use crate::spec::{RelocModel, Target}; +use std::fmt; + use rustc_data_structures::fx::FxIndexSet; use rustc_span::Symbol; -use std::fmt; + +use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; +use crate::spec::{RelocModel, Target}; def_reg_class! { X86 X86InlineAsmRegClass { diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index 05542009083..39d7cf7d097 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -1,8 +1,10 @@ -use std::{borrow::Cow, env}; +use std::borrow::Cow; +use std::env; -use crate::spec::{add_link_args, add_link_args_iter}; -use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs, LinkerFlavor, Lld}; -use crate::spec::{SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions}; +use crate::spec::{ + add_link_args, add_link_args_iter, cvs, Cc, DebuginfoKind, FramePointer, LinkArgs, + LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions, +}; #[cfg(test)] mod tests; diff --git a/compiler/rustc_target/src/spec/base/avr_gnu.rs b/compiler/rustc_target/src/spec/base/avr_gnu.rs index 211d52f5b07..c3d0344ea6c 100644 --- a/compiler/rustc_target/src/spec/base/avr_gnu.rs +++ b/compiler/rustc_target/src/spec/base/avr_gnu.rs @@ -1,6 +1,7 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions}; use object::elf; +use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions}; + /// A base target for AVR devices using the GNU toolchain. /// /// Requires GNU avr-gcc and avr-binutils on the host system. diff --git a/compiler/rustc_target/src/spec/base/linux.rs b/compiler/rustc_target/src/spec/base/linux.rs index df8e848124a..34b2eb0f641 100644 --- a/compiler/rustc_target/src/spec/base/linux.rs +++ b/compiler/rustc_target/src/spec/base/linux.rs @@ -1,6 +1,7 @@ -use crate::spec::{cvs, RelroLevel, SplitDebuginfo, TargetOptions}; use std::borrow::Cow; +use crate::spec::{cvs, RelroLevel, SplitDebuginfo, TargetOptions}; + pub fn opts() -> TargetOptions { TargetOptions { os: "linux".into(), diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs index 5117cadbee0..42aa1e1a6da 100644 --- a/compiler/rustc_target/src/spec/base/linux_musl.rs +++ b/compiler/rustc_target/src/spec/base/linux_musl.rs @@ -1,5 +1,4 @@ -use crate::spec::crt_objects; -use crate::spec::{base, LinkSelfContainedDefault, TargetOptions}; +use crate::spec::{base, crt_objects, LinkSelfContainedDefault, TargetOptions}; pub fn opts() -> TargetOptions { let mut base = base::linux::opts(); diff --git a/compiler/rustc_target/src/spec/base/msvc.rs b/compiler/rustc_target/src/spec/base/msvc.rs index 44fc376fea0..720cf03005a 100644 --- a/compiler/rustc_target/src/spec/base/msvc.rs +++ b/compiler/rustc_target/src/spec/base/msvc.rs @@ -1,6 +1,7 @@ -use crate::spec::{DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; use std::borrow::Cow; +use crate::spec::{DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; + pub fn opts() -> TargetOptions { // Suppress the verbose logo and authorship debugging output, which would needlessly // clog any log files. diff --git a/compiler/rustc_target/src/spec/base/windows_gnu.rs b/compiler/rustc_target/src/spec/base/windows_gnu.rs index 1357de2dad1..7346e42dd91 100644 --- a/compiler/rustc_target/src/spec/base/windows_gnu.rs +++ b/compiler/rustc_target/src/spec/base/windows_gnu.rs @@ -1,8 +1,10 @@ -use crate::spec::LinkSelfContainedDefault; -use crate::spec::{add_link_args, crt_objects}; -use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; use std::borrow::Cow; +use crate::spec::{ + add_link_args, crt_objects, cvs, Cc, DebuginfoKind, LinkSelfContainedDefault, LinkerFlavor, + Lld, SplitDebuginfo, TargetOptions, +}; + pub fn opts() -> TargetOptions { let mut pre_link_args = TargetOptions::link_args( LinkerFlavor::Gnu(Cc::No, Lld::No), diff --git a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs index b1d8e2be5a6..88c3b8a81ad 100644 --- a/compiler/rustc_target/src/spec/base/windows_gnullvm.rs +++ b/compiler/rustc_target/src/spec/base/windows_gnullvm.rs @@ -1,6 +1,7 @@ -use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; use std::borrow::Cow; +use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions}; + pub fn opts() -> TargetOptions { // We cannot use `-nodefaultlibs` because compiler-rt has to be passed // as a path since it's not added to linker search path by the default. diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs index 53f710b8f9e..e3b6430a463 100644 --- a/compiler/rustc_target/src/spec/crt_objects.rs +++ b/compiler/rustc_target/src/spec/crt_objects.rs @@ -40,10 +40,11 @@ //! but not gcc's. As a result rustc cannot link with C++ static libraries (#36710) //! when linking in self-contained mode. -use crate::spec::LinkOutputKind; use std::borrow::Cow; use std::collections::BTreeMap; +use crate::spec::LinkOutputKind; + pub type CrtObjects = BTreeMap<LinkOutputKind, Vec<Cow<'static, str>>>; pub(super) fn new(obj_table: &[(LinkOutputKind, &[&'static str])]) -> CrtObjects { diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 0efe68252af..946947124c6 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -34,16 +34,6 @@ //! the target's settings, though `target-feature` and `link-args` will *add* //! to the list specified by the target, rather than replace. -use crate::abi::call::Conv; -use crate::abi::{Endian, Integer, Size, TargetDataLayout, TargetDataLayoutErrors}; -use crate::json::{Json, ToJson}; -use crate::spec::abi::Abi; -use crate::spec::crt_objects::CrtObjects; -use rustc_fs_util::try_canonicalize; -use rustc_macros::{Decodable, Encodable, HashStable_Generic}; -use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; -use rustc_span::symbol::{kw, sym, Symbol}; -use serde_json::Value; use std::borrow::Cow; use std::collections::BTreeMap; use std::hash::{Hash, Hasher}; @@ -51,15 +41,28 @@ use std::ops::{Deref, DerefMut}; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::{fmt, io}; + +use rustc_fs_util::try_canonicalize; +use rustc_macros::{Decodable, Encodable, HashStable_Generic}; +use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; +use rustc_span::symbol::{kw, sym, Symbol}; +use serde_json::Value; use tracing::debug; +use crate::abi::call::Conv; +use crate::abi::{Endian, Integer, Size, TargetDataLayout, TargetDataLayoutErrors}; +use crate::json::{Json, ToJson}; +use crate::spec::abi::Abi; +use crate::spec::crt_objects::CrtObjects; + pub mod abi; pub mod crt_objects; mod base; -pub use base::apple::deployment_target as current_apple_deployment_target; -pub use base::apple::platform as current_apple_platform; -pub use base::apple::sdk_version as current_apple_sdk_version; +pub use base::apple::{ + deployment_target as current_apple_deployment_target, platform as current_apple_platform, + sdk_version as current_apple_sdk_version, +}; pub use base::avr_gnu::ef_avr_arch; /// Linker is called through a C/C++ compiler. @@ -3353,8 +3356,7 @@ impl Target { target_triple: &TargetTriple, sysroot: &Path, ) -> Result<(Target, TargetWarnings), String> { - use std::env; - use std::fs; + use std::{env, fs}; fn load_file(path: &Path) -> Result<(Target, TargetWarnings), String> { let contents = fs::read_to_string(path).map_err(|e| e.to_string())?; diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs index 5924e4f5757..726a85c81f3 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs @@ -1,5 +1,4 @@ -use crate::spec::SanitizerSet; -use crate::spec::{base, StackProbeType, Target, TargetOptions}; +use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions}; pub fn target() -> Target { let mut base = base::linux_ohos::opts(); diff --git a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs index 8cddb6fe005..eb223af8cf4 100644 --- a/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs @@ -1,5 +1,5 @@ -use crate::spec::Target; -use crate::{abi::Endian, spec::base}; +use crate::abi::Endian; +use crate::spec::{base, Target}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs index d070aa0ec44..12164adc00f 100644 --- a/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs @@ -1,5 +1,5 @@ -use crate::spec::Target; -use crate::{abi::Endian, spec::base}; +use crate::abi::Endian; +use crate::spec::{base, Target}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs index 744ffff721f..138491972e5 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs @@ -1,5 +1,6 @@ -use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{ + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs index a382e7a53fb..41519078f80 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs @@ -1,5 +1,6 @@ -use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{ + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs index 15156fbcfc9..ec5edfb6e42 100644 --- a/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs +++ b/compiler/rustc_target/src/spec/targets/nvptx64_nvidia_cuda.rs @@ -1,5 +1,6 @@ -use crate::spec::LinkSelfContainedDefault; -use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions}; +use crate::spec::{ + LinkSelfContainedDefault, LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs index 726778aca0d..8aa5e098890 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32im_risc0_zkvm_elf.rs @@ -1,5 +1,4 @@ -use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs index a75f8969a73..bfd88bd042e 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_none_elf.rs @@ -1,6 +1,7 @@ -use crate::spec::SanitizerSet; -use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; -use crate::spec::{RelocModel, Target, TargetOptions}; +use crate::spec::{ + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, + TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs index 6a468227ba6..5bea708e0dd 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs @@ -1,6 +1,7 @@ -use crate::spec::SanitizerSet; -use crate::spec::{cvs, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; -use crate::spec::{RelocModel, Target, TargetOptions}; +use crate::spec::{ + cvs, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, + TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs index ba9a10e6633..fa3f1eff457 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_none_elf.rs @@ -1,5 +1,7 @@ -use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; -use crate::spec::{RelocModel, SanitizerSet, Target, TargetOptions}; +use crate::spec::{ + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, + TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs index 1e18466c206..215c0724f91 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs @@ -1,6 +1,7 @@ -use crate::spec::SanitizerSet; -use crate::spec::{cvs, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; -use crate::spec::{RelocModel, Target, TargetOptions}; +use crate::spec::{ + cvs, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target, + TargetOptions, +}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs index 96dd8588d4f..8806f3e87fa 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs @@ -9,8 +9,7 @@ //! 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::{base, PanicStrategy, RelocModel, Target, TargetOptions}; -use crate::spec::{cvs, FramePointer}; +use crate::spec::{base, cvs, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs index a8e7f22c068..29e6dff2068 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs @@ -10,9 +10,7 @@ //! was since renamed to `wasm32-wasip1` after the preview2 target was //! introduced. -use crate::spec::crt_objects; -use crate::spec::LinkSelfContainedDefault; -use crate::spec::{base, Cc, LinkerFlavor, Target}; +use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target}; pub fn target() -> Target { let mut options = base::wasm::options(); diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs index 63d1f4869be..489bae4fedf 100644 --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs @@ -16,9 +16,7 @@ //! You can see more about wasi at <https://wasi.dev> and the component model at //! <https://github.com/WebAssembly/component-model>. -use crate::spec::crt_objects; -use crate::spec::LinkSelfContainedDefault; -use crate::spec::{base, RelocModel, Target}; +use crate::spec::{base, crt_objects, LinkSelfContainedDefault, RelocModel, Target}; pub fn target() -> Target { let mut options = base::wasm::options(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index 94638ae62f8..c3a52a506bc 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -1,6 +1,5 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64; diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs index 549706998d4..175a53f237d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs @@ -4,8 +4,10 @@ // `target-cpu` compiler flags to opt-in more hardware-specific // features. -use crate::spec::{Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy}; -use crate::spec::{RelroLevel, SanitizerSet, StackProbeType, Target, TargetOptions}; +use crate::spec::{ + Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelroLevel, SanitizerSet, StackProbeType, + Target, TargetOptions, +}; pub fn target() -> Target { let opts = TargetOptions { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs index 6da1fcca58c..2933da92fcc 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs @@ -5,10 +5,8 @@ // 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::{ - abi::call::Conv, - spec::{base, Target}, -}; +use crate::abi::call::Conv; +use crate::spec::{base, Target}; pub fn target() -> Target { let mut base = base::uefi_msvc::opts(); diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs index 72cbc1be931..a932d4a3cb4 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs @@ -1,6 +1,5 @@ use crate::spec::base::apple::{macos_llvm_target, opts, Arch, TargetAbi}; -use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet}; -use crate::spec::{Target, TargetOptions}; +use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions}; pub fn target() -> Target { let arch = Arch::X86_64h; diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs index 1b66fdbd2af..f041e791a9b 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs @@ -1,5 +1,6 @@ use crate::abi::Endian; -use crate::spec::{base::xtensa, cvs, Target, TargetOptions}; +use crate::spec::base::xtensa; +use crate::spec::{cvs, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs index bf523716313..05666bd81aa 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs @@ -1,4 +1,5 @@ -use crate::spec::{base::xtensa, Target, TargetOptions}; +use crate::spec::base::xtensa; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs index ad5fda8a4ae..83ef520551f 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs @@ -1,5 +1,6 @@ use crate::abi::Endian; -use crate::spec::{base::xtensa, cvs, Target, TargetOptions}; +use crate::spec::base::xtensa; +use crate::spec::{cvs, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs index 219b2aa48c1..aa125eb1ba6 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs @@ -1,4 +1,5 @@ -use crate::spec::{base::xtensa, Target, TargetOptions}; +use crate::spec::base::xtensa; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs index ab1d1df43dd..e18acfccf5f 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs @@ -1,5 +1,6 @@ use crate::abi::Endian; -use crate::spec::{base::xtensa, cvs, Target, TargetOptions}; +use crate::spec::base::xtensa; +use crate::spec::{cvs, Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs index 632eef3a584..ecbb51dfb66 100644 --- a/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs +++ b/compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs @@ -1,4 +1,5 @@ -use crate::spec::{base::xtensa, Target, TargetOptions}; +use crate::spec::base::xtensa; +use crate::spec::{Target, TargetOptions}; pub fn target() -> Target { Target { diff --git a/compiler/rustc_target/src/spec/tests/tests_impl.rs b/compiler/rustc_target/src/spec/tests/tests_impl.rs index 3be18ef3127..fc5bd846e02 100644 --- a/compiler/rustc_target/src/spec/tests/tests_impl.rs +++ b/compiler/rustc_target/src/spec/tests/tests_impl.rs @@ -1,6 +1,7 @@ -use super::super::*; use std::assert_matches::assert_matches; +use super::super::*; + // Test target self-consistency and JSON encoding/decoding roundtrip. pub(super) fn test_target(mut target: Target) { let recycled_target = Target::from_json(target.to_json()).map(|(j, _)| j); diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 4fb0323b6cf..532507cb182 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -1,5 +1,4 @@ -use rustc_span::symbol::sym; -use rustc_span::symbol::Symbol; +use rustc_span::symbol::{sym, Symbol}; /// Features that control behaviour of rustc, rather than the codegen. pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"]; |
