From 90300ef40b5098e48162d4e4ae32c8f4db9c7c5c Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 15 Aug 2024 09:55:56 +0200 Subject: [PATCH 1/2] add `C-cmse-nonsecure-entry` ABI --- src/abi/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 24cf3f061a5..8838b15d29d 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -61,6 +61,9 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call Conv::CCmseNonSecureCall => { sess.dcx().fatal("C-cmse-nonsecure-call call conv is not yet implemented"); } + Conv::CCmseNonSecureEntry => { + sess.dcx().fatal("C-cmse-nonsecure-entry call conv is not yet implemented"); + } Conv::Msp430Intr | Conv::PtxKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => { unreachable!("tried to use {c:?} call conv which only exists on an unsupported target"); From 02b0f3b5ab793973e31d4725b6caf6bf849c22b6 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 22 Sep 2024 19:05:04 -0400 Subject: [PATCH 2/2] Reformat using the new identifier sorting from rustfmt --- build_system/abi_cafe.rs | 4 ++-- build_system/bench.rs | 2 +- build_system/build_sysroot.rs | 4 ++-- build_system/tests.rs | 6 +++--- example/std_example.rs | 7 +++---- src/abi/mod.rs | 2 +- src/abi/pass_mode.rs | 2 +- src/abi/returning.rs | 2 +- src/allocator.rs | 4 ++-- src/base.rs | 4 ++-- src/common.rs | 2 +- src/constant.rs | 2 +- src/debuginfo/emit.rs | 2 +- src/debuginfo/line_info.rs | 6 +++--- src/debuginfo/object.rs | 21 +++++++++------------ src/debuginfo/types.rs | 2 +- src/debuginfo/unwind.rs | 4 ++-- src/driver/aot.rs | 10 +++++----- src/driver/jit.rs | 16 ++++++---------- src/inline_asm.rs | 14 +++++--------- src/intrinsics/llvm_x86.rs | 2 +- src/intrinsics/mod.rs | 4 ++-- src/intrinsics/simd.rs | 9 +++------ src/lib.rs | 14 +++++++------- src/main_shim.rs | 15 ++++++--------- src/pretty_clif.rs | 2 +- src/trap.rs | 14 +++++--------- 27 files changed, 77 insertions(+), 99 deletions(-) diff --git a/build_system/abi_cafe.rs b/build_system/abi_cafe.rs index e3f1162445b..c0873a20e53 100644 --- a/build_system/abi_cafe.rs +++ b/build_system/abi_cafe.rs @@ -1,7 +1,7 @@ use crate::path::{Dirs, RelPath}; use crate::prepare::GitRepo; -use crate::utils::{spawn_and_wait, CargoProject, Compiler}; -use crate::{build_sysroot, CodegenBackend, SysrootKind}; +use crate::utils::{CargoProject, Compiler, spawn_and_wait}; +use crate::{CodegenBackend, SysrootKind, build_sysroot}; static ABI_CAFE_REPO: GitRepo = GitRepo::github( "Gankra", diff --git a/build_system/bench.rs b/build_system/bench.rs index 6c64faaa256..501e128d180 100644 --- a/build_system/bench.rs +++ b/build_system/bench.rs @@ -5,7 +5,7 @@ use crate::path::{Dirs, RelPath}; use crate::prepare::GitRepo; use crate::rustc_info::get_file_name; -use crate::utils::{hyperfine_command, spawn_and_wait, Compiler}; +use crate::utils::{Compiler, hyperfine_command, spawn_and_wait}; static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github( "ebobby", diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index e41f6c5e709..b11dc6a0eed 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -5,9 +5,9 @@ use crate::path::{Dirs, RelPath}; use crate::rustc_info::get_file_name; use crate::utils::{ - remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, LogGroup, + CargoProject, Compiler, LogGroup, remove_dir_if_exists, spawn_and_wait, try_hard_link, }; -use crate::{config, CodegenBackend, SysrootKind}; +use crate::{CodegenBackend, SysrootKind, config}; static DIST_DIR: RelPath = RelPath::DIST; static BIN_DIR: RelPath = RelPath::DIST.join("bin"); diff --git a/build_system/tests.rs b/build_system/tests.rs index 38c3786a94a..602f7eccf23 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -4,11 +4,11 @@ use std::process::Command; use crate::path::{Dirs, RelPath}; -use crate::prepare::{apply_patches, GitRepo}; +use crate::prepare::{GitRepo, apply_patches}; use crate::rustc_info::get_default_sysroot; use crate::shared_utils::rustflags_from_env; -use crate::utils::{spawn_and_wait, CargoProject, Compiler, LogGroup}; -use crate::{build_sysroot, config, CodegenBackend, SysrootKind}; +use crate::utils::{CargoProject, Compiler, LogGroup, spawn_and_wait}; +use crate::{CodegenBackend, SysrootKind, build_sysroot, config}; static BUILD_EXAMPLE_OUT_DIR: RelPath = RelPath::BUILD.join("example"); diff --git a/example/std_example.rs b/example/std_example.rs index f27d4ef57e0..602452d8276 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -238,10 +238,9 @@ unsafe fn test_simd() { let (zero0, zero1) = std::mem::transmute::<_, (u64, u64)>(x); assert_eq!((zero0, zero1), (0, 0)); assert_eq!(std::mem::transmute::<_, [u16; 8]>(or), [7, 7, 7, 7, 7, 7, 7, 7]); - assert_eq!( - std::mem::transmute::<_, [u16; 8]>(cmp_eq), - [0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff] - ); + assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_eq), [ + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff + ]); assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_lt), [0, 0, 0, 0, 0, 0, 0, 0]); test_mm_slli_si128(); diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 8838b15d29d..cb74c59046b 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -13,9 +13,9 @@ use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization; use rustc_codegen_ssa::errors::CompilerBuiltinsCannotCall; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; +use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; -use rustc_middle::ty::TypeVisitableExt; use rustc_session::Session; use rustc_span::source_map::Spanned; use rustc_target::abi::call::{Conv, FnAbi, PassMode}; diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs index 06522670029..38c322b5e04 100644 --- a/src/abi/pass_mode.rs +++ b/src/abi/pass_mode.rs @@ -4,7 +4,7 @@ use rustc_target::abi::call::{ ArgAbi, ArgAttributes, ArgExtension as RustcArgExtension, CastTarget, PassMode, Reg, RegKind, }; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use crate::prelude::*; use crate::value_and_place::assert_assignable; diff --git a/src/abi/returning.rs b/src/abi/returning.rs index e0f399e616e..a294c789b22 100644 --- a/src/abi/returning.rs +++ b/src/abi/returning.rs @@ -1,7 +1,7 @@ //! Return value handling use rustc_target::abi::call::{ArgAbi, PassMode}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use crate::prelude::*; diff --git a/src/allocator.rs b/src/allocator.rs index b4a3825e996..5e33b9d606f 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -2,8 +2,8 @@ // Adapted from rustc use rustc_ast::expand::allocator::{ - alloc_error_handler_name, default_fn_name, global_fn_name, AllocatorKind, AllocatorTy, - ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE, + ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, + alloc_error_handler_name, default_fn_name, global_fn_name, }; use rustc_codegen_ssa::base::allocator_kind_for_codegen; use rustc_session::config::OomStrategy; diff --git a/src/base.rs b/src/base.rs index 8839829e2f5..dc342e151f3 100644 --- a/src/base.rs +++ b/src/base.rs @@ -1,17 +1,17 @@ //! Codegen of a single function -use cranelift_codegen::ir::UserFuncName; use cranelift_codegen::CodegenError; +use cranelift_codegen::ir::UserFuncName; use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use cranelift_module::ModuleError; use rustc_ast::InlineAsmOptions; use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization; use rustc_index::IndexVec; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; +use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; -use rustc_middle::ty::TypeVisitableExt; use crate::constant::ConstantCx; use crate::debuginfo::{FunctionDebugContext, TypeDebugContext}; diff --git a/src/common.rs b/src/common.rs index 22ca2070715..e78ba5a3415 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,10 +1,10 @@ use cranelift_codegen::isa::TargetFrontendConfig; use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use rustc_index::IndexVec; +use rustc_middle::ty::TypeFoldable; use rustc_middle::ty::layout::{ self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers, }; -use rustc_middle::ty::TypeFoldable; use rustc_span::source_map::Spanned; use rustc_target::abi::call::FnAbi; use rustc_target::abi::{Float, Integer, Primitive}; diff --git a/src/constant.rs b/src/constant.rs index 0ba163f50ae..8964230d6e2 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -5,7 +5,7 @@ use cranelift_module::*; use rustc_data_structures::fx::FxHashSet; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; -use rustc_middle::mir::interpret::{read_target_uint, AllocId, GlobalAlloc, Scalar}; +use rustc_middle::mir::interpret::{AllocId, GlobalAlloc, Scalar, read_target_uint}; use rustc_middle::ty::{Binder, ExistentialTraitRef, ScalarInt}; use crate::prelude::*; diff --git a/src/debuginfo/emit.rs b/src/debuginfo/emit.rs index 36af7d4450d..ccdc347af66 100644 --- a/src/debuginfo/emit.rs +++ b/src/debuginfo/emit.rs @@ -6,8 +6,8 @@ use gimli::{RunTimeEndian, SectionId}; use rustc_data_structures::fx::FxHashMap; -use super::object::WriteDebugInfo; use super::DebugContext; +use super::object::WriteDebugInfo; pub(super) fn address_for_func(func_id: FuncId) -> Address { let symbol = func_id.as_u32(); diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs index 78b3d5a58f4..c3d9d635084 100644 --- a/src/debuginfo/line_info.rs +++ b/src/debuginfo/line_info.rs @@ -3,15 +3,15 @@ use std::ffi::OsStr; use std::path::{Component, Path}; -use cranelift_codegen::binemit::CodeOffset; use cranelift_codegen::MachSrcLoc; +use cranelift_codegen::binemit::CodeOffset; use gimli::write::{AttributeValue, FileId, FileInfo, LineProgram, LineString, LineStringTable}; use rustc_span::{ - hygiene, FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm, + FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm, hygiene, }; -use crate::debuginfo::emit::address_for_func; use crate::debuginfo::FunctionDebugContext; +use crate::debuginfo::emit::address_for_func; use crate::prelude::*; // OPTIMIZATION: It is cheaper to do this in one pass than using `.parent()` and `.file_name()`. diff --git a/src/debuginfo/object.rs b/src/debuginfo/object.rs index 1c6e471cc87..048a388731f 100644 --- a/src/debuginfo/object.rs +++ b/src/debuginfo/object.rs @@ -73,19 +73,16 @@ fn add_debug_reloc( } }; self.object - .add_relocation( - from.0, - Relocation { - offset: u64::from(reloc.offset), - symbol, - flags: RelocationFlags::Generic { - kind: reloc.kind, - encoding: RelocationEncoding::Generic, - size: reloc.size * 8, - }, - addend: i64::try_from(symbol_offset).unwrap() + reloc.addend, + .add_relocation(from.0, Relocation { + offset: u64::from(reloc.offset), + symbol, + flags: RelocationFlags::Generic { + kind: reloc.kind, + encoding: RelocationEncoding::Generic, + size: reloc.size * 8, }, - ) + addend: i64::try_from(symbol_offset).unwrap() + reloc.addend, + }) .unwrap(); } } diff --git a/src/debuginfo/types.rs b/src/debuginfo/types.rs index 8a55a23128d..a710701e72c 100644 --- a/src/debuginfo/types.rs +++ b/src/debuginfo/types.rs @@ -6,7 +6,7 @@ use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::{self, Ty, TyCtxt}; -use crate::{has_ptr_meta, DebugContext, RevealAllLayoutCx}; +use crate::{DebugContext, RevealAllLayoutCx, has_ptr_meta}; #[derive(Default)] pub(crate) struct TypeDebugContext<'tcx> { diff --git a/src/debuginfo/unwind.rs b/src/debuginfo/unwind.rs index ac7dd0bd463..9399230f292 100644 --- a/src/debuginfo/unwind.rs +++ b/src/debuginfo/unwind.rs @@ -1,11 +1,11 @@ //! Unwind info generation (`.eh_frame`) use cranelift_codegen::ir::Endianness; -use cranelift_codegen::isa::unwind::UnwindInfo; use cranelift_codegen::isa::TargetIsa; +use cranelift_codegen::isa::unwind::UnwindInfo; use cranelift_object::ObjectProduct; -use gimli::write::{CieId, EhFrame, FrameTable, Section}; use gimli::RunTimeEndian; +use gimli::write::{CieId, EhFrame, FrameTable, Section}; use super::emit::address_for_func; use super::object::WriteDebugInfo; diff --git a/src/driver/aot.rs b/src/driver/aot.rs index b6fee1bf24a..419efa90600 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -12,24 +12,24 @@ use rustc_codegen_ssa::back::metadata::create_compressed_metadata_file; use rustc_codegen_ssa::base::determine_cgu_reuse; use rustc_codegen_ssa::{ - errors as ssa_errors, CodegenResults, CompiledModule, CrateInfo, ModuleKind, + CodegenResults, CompiledModule, CrateInfo, ModuleKind, errors as ssa_errors, }; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -use rustc_data_structures::sync::{par_map, IntoDynSyncSend}; -use rustc_metadata::fs::copy_to_stdout; +use rustc_data_structures::sync::{IntoDynSyncSend, par_map}; use rustc_metadata::EncodedMetadata; +use rustc_metadata::fs::copy_to_stdout; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_middle::mir::mono::{CodegenUnit, MonoItem}; -use rustc_session::config::{DebugInfo, OutFileName, OutputFilenames, OutputType}; use rustc_session::Session; +use rustc_session::config::{DebugInfo, OutFileName, OutputFilenames, OutputType}; +use crate::BackendConfig; use crate::concurrency_limiter::{ConcurrencyLimiter, ConcurrencyLimiterToken}; use crate::debuginfo::TypeDebugContext; use crate::global_asm::GlobalAsmConfig; use crate::prelude::*; use crate::unwind_module::UnwindModule; -use crate::BackendConfig; struct ModuleCodegenResult { module_regular: CompiledModule, diff --git a/src/driver/jit.rs b/src/driver/jit.rs index 12e860f676d..0d62a13b472 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -4,7 +4,7 @@ use std::cell::RefCell; use std::ffi::CString; use std::os::raw::{c_char, c_int}; -use std::sync::{mpsc, Mutex, OnceLock}; +use std::sync::{Mutex, OnceLock, mpsc}; use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use cranelift_jit::{JITBuilder, JITModule}; @@ -359,15 +359,11 @@ fn codegen_shim<'tcx>( let instance_ptr = Box::into_raw(Box::new(inst)); let jit_fn = module - .declare_function( - "__clif_jit_fn", - Linkage::Import, - &Signature { - call_conv: module.target_config().default_call_conv, - params: vec![AbiParam::new(pointer_type), AbiParam::new(pointer_type)], - returns: vec![AbiParam::new(pointer_type)], - }, - ) + .declare_function("__clif_jit_fn", Linkage::Import, &Signature { + call_conv: module.target_config().default_call_conv, + params: vec![AbiParam::new(pointer_type), AbiParam::new(pointer_type)], + returns: vec![AbiParam::new(pointer_type)], + }) .unwrap(); let context = cached_context; diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 16edec47e10..41f1b30d10b 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -869,15 +869,11 @@ fn call_inline_asm<'tcx>( let inline_asm_func = fx .module - .declare_function( - asm_name, - Linkage::Import, - &Signature { - call_conv: CallConv::SystemV, - params: vec![AbiParam::new(fx.pointer_type)], - returns: vec![], - }, - ) + .declare_function(asm_name, Linkage::Import, &Signature { + call_conv: CallConv::SystemV, + params: vec![AbiParam::new(fx.pointer_type)], + returns: vec![], + }) .unwrap(); let inline_asm_func = fx.module.declare_func_in_func(inline_asm_func, fx.bcx.func); if fx.clif_comments.enabled() { diff --git a/src/intrinsics/llvm_x86.rs b/src/intrinsics/llvm_x86.rs index cb003037c26..c02d31844e0 100644 --- a/src/intrinsics/llvm_x86.rs +++ b/src/intrinsics/llvm_x86.rs @@ -3,7 +3,7 @@ use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_target::asm::*; -use crate::inline_asm::{codegen_inline_asm_inner, CInlineAsmOperand}; +use crate::inline_asm::{CInlineAsmOperand, codegen_inline_asm_inner}; use crate::intrinsics::*; use crate::prelude::*; diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 29deac60730..0740c84a534 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -19,11 +19,11 @@ macro_rules! intrinsic_args { use cranelift_codegen::ir::AtomicRmwOp; use rustc_middle::ty; +use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::layout::{HasParamEnv, ValidityRequirement}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; -use rustc_middle::ty::GenericArgsRef; use rustc_span::source_map::Spanned; -use rustc_span::symbol::{sym, Symbol}; +use rustc_span::symbol::{Symbol, sym}; pub(crate) use self::llvm::codegen_llvm_intrinsic_call; use crate::cast::clif_intcast; diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index b96abb14b2e..f2bdf24d8ab 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -574,12 +574,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( (sym::simd_round, types::F64) => "round", _ => unreachable!("{:?}", intrinsic), }; - fx.lib_call( - name, - vec![AbiParam::new(lane_ty)], - vec![AbiParam::new(lane_ty)], - &[lane], - )[0] + fx.lib_call(name, vec![AbiParam::new(lane_ty)], vec![AbiParam::new(lane_ty)], &[ + lane, + ])[0] }); } diff --git a/src/lib.rs b/src/lib.rs index f737af25b62..f6b7981395a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,15 +38,15 @@ use cranelift_codegen::isa::TargetIsa; use cranelift_codegen::settings::{self, Configurable}; -use rustc_codegen_ssa::traits::CodegenBackend; use rustc_codegen_ssa::CodegenResults; +use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_errors::ErrorGuaranteed; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; -use rustc_session::config::OutputFilenames; use rustc_session::Session; -use rustc_span::{sym, Symbol}; +use rustc_session::config::OutputFilenames; +use rustc_span::{Symbol, sym}; pub use crate::config::*; use crate::prelude::*; @@ -83,13 +83,13 @@ mod vtable; mod prelude { + pub(crate) use cranelift_codegen::Context; pub(crate) use cranelift_codegen::ir::condcodes::{FloatCC, IntCC}; pub(crate) use cranelift_codegen::ir::function::Function; pub(crate) use cranelift_codegen::ir::{ - types, AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, - StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value, + AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, + StackSlotData, StackSlotKind, TrapCode, Type, Value, types, }; - pub(crate) use cranelift_codegen::Context; pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module}; pub(crate) use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE}; @@ -100,7 +100,7 @@ mod prelude { self, FloatTy, Instance, InstanceKind, IntTy, ParamEnv, Ty, TyCtxt, UintTy, }; pub(crate) use rustc_span::Span; - pub(crate) use rustc_target::abi::{Abi, FieldIdx, Scalar, Size, VariantIdx, FIRST_VARIANT}; + pub(crate) use rustc_target::abi::{Abi, FIRST_VARIANT, FieldIdx, Scalar, Size, VariantIdx}; pub(crate) use crate::abi::*; pub(crate) use crate::base::{codegen_operand, codegen_place}; diff --git a/src/main_shim.rs b/src/main_shim.rs index ba20a750d2b..df92bc58bf5 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -1,9 +1,9 @@ use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use rustc_hir::LangItem; use rustc_middle::ty::{AssocKind, GenericArg}; -use rustc_session::config::{sigpipe, EntryFnType}; -use rustc_span::symbol::Ident; +use rustc_session::config::{EntryFnType, sigpipe}; use rustc_span::DUMMY_SP; +use rustc_span::symbol::Ident; use crate::prelude::*; @@ -16,13 +16,10 @@ pub(crate) fn maybe_create_entry_wrapper( is_primary_cgu: bool, ) { let (main_def_id, (is_main_fn, sigpipe)) = match tcx.entry_fn(()) { - Some((def_id, entry_ty)) => ( - def_id, - match entry_ty { - EntryFnType::Main { sigpipe } => (true, sigpipe), - EntryFnType::Start => (false, sigpipe::DEFAULT), - }, - ), + Some((def_id, entry_ty)) => (def_id, match entry_ty { + EntryFnType::Main { sigpipe } => (true, sigpipe), + EntryFnType::Start => (false, sigpipe::DEFAULT), + }), None => return, }; diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs index 196418023d9..13877b3b1e9 100644 --- a/src/pretty_clif.rs +++ b/src/pretty_clif.rs @@ -59,8 +59,8 @@ use std::io::Write; use cranelift_codegen::entity::SecondaryMap; -use cranelift_codegen::ir::entities::AnyEntity; use cranelift_codegen::ir::Fact; +use cranelift_codegen::ir::entities::AnyEntity; use cranelift_codegen::write::{FuncWriter, PlainWriter}; use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; diff --git a/src/trap.rs b/src/trap.rs index 2fb0c2164c3..a61e1e334ec 100644 --- a/src/trap.rs +++ b/src/trap.rs @@ -5,15 +5,11 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) { let puts = fx .module - .declare_function( - "puts", - Linkage::Import, - &Signature { - call_conv: fx.target_config.default_call_conv, - params: vec![AbiParam::new(fx.pointer_type)], - returns: vec![AbiParam::new(types::I32)], - }, - ) + .declare_function("puts", Linkage::Import, &Signature { + call_conv: fx.target_config.default_call_conv, + params: vec![AbiParam::new(fx.pointer_type)], + returns: vec![AbiParam::new(types::I32)], + }) .unwrap(); let puts = fx.module.declare_func_in_func(puts, &mut fx.bcx.func); if fx.clif_comments.enabled() {