From c7ed1ce03332e2c4affb0ad04b503415ca8cb1da Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 13 Aug 2018 18:04:39 +0200 Subject: [PATCH] Rustfmt --- src/constant.rs | 16 ++++++++-------- src/lib.rs | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/constant.rs b/src/constant.rs index fd3d3d67c3f5..84955d445441 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -11,7 +11,11 @@ pub struct ConstantCx { } impl ConstantCx { - pub fn finalize<'a, 'tcx: 'a, B: Backend>(mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>, module: &mut Module) { + pub fn finalize<'a, 'tcx: 'a, B: Backend>( + mut self, + tcx: TyCtxt<'a, 'tcx, 'tcx>, + module: &mut Module, + ) { println!("todo allocs: {:?}", self.todo_allocs); define_all_allocs(tcx, module, &mut self); println!("done {:?}", self.done); @@ -111,11 +115,7 @@ fn trans_const_place<'a, 'tcx: 'a>( let alloc = fx.tcx.const_value_to_allocation(const_); //println!("const value: {:?} allocation: {:?}", value, alloc); let alloc_id = fx.tcx.alloc_map.lock().allocate(alloc); - let data_id = get_global_for_alloc_id( - fx.module, - fx.constants, - alloc_id, - ); + let data_id = get_global_for_alloc_id(fx.module, fx.constants, alloc_id); let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func); // TODO: does global_value return a ptr of a val? let global_ptr = fx.bcx.ins().global_value(types::I64, local_data_id); @@ -143,7 +143,7 @@ fn get_global_for_alloc_id<'a, 'tcx: 'a, B: Backend + 'a>( data_id } -fn define_all_allocs<'a, 'tcx: 'a, B: Backend + 'a> ( +fn define_all_allocs<'a, 'tcx: 'a, B: Backend + 'a>( tcx: TyCtxt<'a, 'tcx, 'tcx>, module: &mut Module, cx: &mut ConstantCx, @@ -196,4 +196,4 @@ fn pop_set(set: &mut HashSet) -> Option } else { None } -} \ No newline at end of file +} diff --git a/src/lib.rs b/src/lib.rs index 706d82ed2f61..7781de1fb3e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,7 +68,7 @@ mod prelude { self, subst::Substs, FnSig, Instance, InstanceDef, ParamEnv, PolyFnSig, Ty, TyCtxt, TypeAndMut, TypeFoldable, TypeVariants, }; - pub use rustc_data_structures::{indexed_vec::Idx, sync::Lrc, fx::FxHashMap}; + pub use rustc_data_structures::{fx::FxHashMap, indexed_vec::Idx, sync::Lrc}; pub use rustc_mir::monomorphize::{collector, MonoItem}; pub use syntax::ast::{FloatTy, IntTy, UintTy}; pub use syntax::codemap::DUMMY_SP; @@ -258,7 +258,9 @@ impl CodegenBackend for CraneliftCodegenBackend { let mut log = ::std::fs::File::create("../target/log.txt").unwrap(); let before = ::std::time::Instant::now(); - let mono_items = collector::collect_crate_mono_items(tcx, collector::MonoItemCollectionMode::Eager).0; + let mono_items = + collector::collect_crate_mono_items(tcx, collector::MonoItemCollectionMode::Eager) + .0; // TODO: move to the end of this function when compiling libcore doesn't have unimplemented stuff anymore save_incremental(tcx);