Skip to content

Commit

Permalink
Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Aug 13, 2018
1 parent d331758 commit c7ed1ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<B>) {
pub fn finalize<'a, 'tcx: 'a, B: Backend>(
mut self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
module: &mut Module<B>,
) {
println!("todo allocs: {:?}", self.todo_allocs);
define_all_allocs(tcx, module, &mut self);
println!("done {:?}", self.done);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<B>,
cx: &mut ConstantCx,
Expand Down Expand Up @@ -196,4 +196,4 @@ fn pop_set<T: Copy + Eq + ::std::hash::Hash>(set: &mut HashSet<T>) -> Option<T>
} else {
None
}
}
}
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c7ed1ce

Please sign in to comment.