From a0cdbd1aa61e47fed13e84cbbda9460ea88b7100 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 5 Jul 2021 18:44:37 +0200 Subject: [PATCH] Rustfmt --- src/bin/cg_clif.rs | 2 +- src/driver/aot.rs | 3 ++- src/driver/jit.rs | 13 ++++++++----- src/intrinsics/llvm.rs | 28 +++++++++++++--------------- src/vtable.rs | 8 ++------ 5 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/bin/cg_clif.rs b/src/bin/cg_clif.rs index 2643fae0a810a..a044b43b86470 100644 --- a/src/bin/cg_clif.rs +++ b/src/bin/cg_clif.rs @@ -6,8 +6,8 @@ extern crate rustc_interface; extern crate rustc_session; extern crate rustc_target; -use std::panic; use std::lazy::SyncLazy; +use std::panic; use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry}; use rustc_interface::interface; diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 5d2c79e3e87a5..74cb665d061e7 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -291,7 +291,8 @@ 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 = + tcx.sess.opts.cg.target_cpu.as_ref().unwrap_or(&tcx.sess.target.cpu).to_owned(); Box::new(( CodegenResults { modules, diff --git a/src/driver/jit.rs b/src/driver/jit.rs index f454d0efab831..8ab9433643242 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -26,7 +26,8 @@ thread_local! { } /// The Sender owned by the rustc thread -static GLOBAL_MESSAGE_SENDER: SyncOnceCell>> = SyncOnceCell::new(); +static GLOBAL_MESSAGE_SENDER: SyncOnceCell>> = + SyncOnceCell::new(); /// A message that is sent from the jitted runtime to the rustc thread. /// Senders are responsible for upholding `Send` semantics. @@ -195,14 +196,17 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! { // lazy JIT compilation request - compile requested instance and return pointer to result UnsafeMessage::JitFn { instance_ptr, trampoline_ptr, tx } => { tx.send(jit_fn(instance_ptr, trampoline_ptr)) - .expect("jitted runtime hung up before response to lazy JIT request was sent"); + .expect("jitted runtime hung up before response to lazy JIT request was sent"); } } } } #[no_mangle] -extern "C" fn __clif_jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) -> *const u8 { +extern "C" fn __clif_jit_fn( + instance_ptr: *const Instance<'static>, + trampoline_ptr: *const u8, +) -> *const u8 { // send the JIT request to the rustc thread, with a channel for the response let (tx, rx) = mpsc::channel(); UnsafeMessage::JitFn { instance_ptr, trampoline_ptr, tx } @@ -210,8 +214,7 @@ extern "C" fn __clif_jit_fn(instance_ptr: *const Instance<'static>, trampoline_p .expect("rustc thread hung up before lazy JIT request was sent"); // block on JIT compilation result - rx.recv() - .expect("rustc thread hung up before responding to sent lazy JIT request") + rx.recv().expect("rustc thread hung up before responding to sent lazy JIT request") } fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) -> *const u8 { diff --git a/src/intrinsics/llvm.rs b/src/intrinsics/llvm.rs index 0b5435285b480..be3704ca2768e 100644 --- a/src/intrinsics/llvm.rs +++ b/src/intrinsics/llvm.rs @@ -148,30 +148,28 @@ fn llvm_add_sub<'tcx>( ret: CPlace<'tcx>, cb_in: Value, a: CValue<'tcx>, - b: CValue<'tcx> + b: CValue<'tcx>, ) { - assert_eq!(a.layout().ty, fx.tcx.types.u64, "llvm.x86.addcarry.64/llvm.x86.subborrow.64 second operand must be u64"); - assert_eq!(b.layout().ty, fx.tcx.types.u64, "llvm.x86.addcarry.64/llvm.x86.subborrow.64 third operand must be u64"); + assert_eq!( + a.layout().ty, + fx.tcx.types.u64, + "llvm.x86.addcarry.64/llvm.x86.subborrow.64 second operand must be u64" + ); + assert_eq!( + b.layout().ty, + fx.tcx.types.u64, + "llvm.x86.addcarry.64/llvm.x86.subborrow.64 third operand must be u64" + ); // c + carry -> c + first intermediate carry or borrow respectively - let int0 = crate::num::codegen_checked_int_binop( - fx, - bin_op, - a, - b, - ); + let int0 = crate::num::codegen_checked_int_binop(fx, bin_op, a, b); let c = int0.value_field(fx, mir::Field::new(0)); let cb0 = int0.value_field(fx, mir::Field::new(1)).load_scalar(fx); // c + carry -> c + second intermediate carry or borrow respectively let cb_in_as_u64 = fx.bcx.ins().uextend(types::I64, cb_in); let cb_in_as_u64 = CValue::by_val(cb_in_as_u64, fx.layout_of(fx.tcx.types.u64)); - let int1 = crate::num::codegen_checked_int_binop( - fx, - bin_op, - c, - cb_in_as_u64, - ); + let int1 = crate::num::codegen_checked_int_binop(fx, bin_op, c, cb_in_as_u64); let (c, cb1) = int1.load_scalar_pair(fx); // carry0 | carry1 -> carry or borrow respectively diff --git a/src/vtable.rs b/src/vtable.rs index 021686544ebea..4a5f9f133a2bb 100644 --- a/src/vtable.rs +++ b/src/vtable.rs @@ -69,12 +69,8 @@ pub(crate) fn get_vtable<'tcx>( trait_ref: Option>, ) -> Value { let alloc_id = fx.tcx.vtable_allocation(ty, trait_ref); - let data_id = data_id_for_alloc_id( - &mut fx.constants_cx, - &mut *fx.module, - alloc_id, - Mutability::Not, - ); + let data_id = + data_id_for_alloc_id(&mut fx.constants_cx, &mut *fx.module, alloc_id, Mutability::Not); let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func); if fx.clif_comments.enabled() { fx.add_comment(local_data_id, format!("vtable: {:?}", alloc_id));