Skip to content

Commit 16e936b

Browse files
committed
Rustfmt
1 parent bc84888 commit 16e936b

File tree

5 files changed

+43
-22
lines changed

5 files changed

+43
-22
lines changed

src/abi.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ fn get_pass_mode<'a, 'tcx: 'a>(
4949
PassMode::ByVal(ret_ty)
5050
} else {
5151
if abi == Abi::C {
52-
unimpl!("Non scalars are not yet supported for \"C\" abi ({:?}) is_return: {:?}", ty, is_return);
52+
unimpl!(
53+
"Non scalars are not yet supported for \"C\" abi ({:?}) is_return: {:?}",
54+
ty,
55+
is_return
56+
);
5357
}
5458
PassMode::ByRef
5559
}
@@ -667,9 +671,10 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
667671
assert_eq!(args.len(), 1);
668672
let layout = fx.layout_of(substs.type_at(0));
669673
let size = match &layout.ty.sty {
670-
_ if !layout.is_unsized() => {
671-
fx.bcx.ins().iconst(fx.module.pointer_type(), layout.size.bytes() as i64)
672-
}
674+
_ if !layout.is_unsized() => fx
675+
.bcx
676+
.ins()
677+
.iconst(fx.module.pointer_type(), layout.size.bytes() as i64),
673678
ty::Slice(elem) => {
674679
let len = args[0].load_value_pair(fx).1;
675680
let elem_size = fx.layout_of(elem).size.bytes();
@@ -690,9 +695,10 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
690695
assert_eq!(args.len(), 1);
691696
let layout = fx.layout_of(substs.type_at(0));
692697
let align = match &layout.ty.sty {
693-
_ if !layout.is_unsized() => {
694-
fx.bcx.ins().iconst(fx.module.pointer_type(), layout.align.abi() as i64)
695-
}
698+
_ if !layout.is_unsized() => fx
699+
.bcx
700+
.ins()
701+
.iconst(fx.module.pointer_type(), layout.align.abi() as i64),
696702
ty::Slice(elem) => {
697703
let align = fx.layout_of(elem).align.abi() as i64;
698704
fx.bcx.ins().iconst(fx.module.pointer_type(), align)
@@ -860,7 +866,8 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
860866
_ if intrinsic.starts_with("atomic_fence") => {}
861867
_ if intrinsic.starts_with("atomic_load") => {
862868
assert_eq!(args.len(), 1);
863-
let inner_layout = fx.layout_of(args[0].layout().ty.builtin_deref(true).unwrap().ty);
869+
let inner_layout =
870+
fx.layout_of(args[0].layout().ty.builtin_deref(true).unwrap().ty);
864871
let val = CValue::ByRef(args[0].load_value(fx), inner_layout);
865872
ret.write_cvalue(fx, val);
866873
}

src/base.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(
2727
if inst.def_id().krate == LOCAL_CRATE =>
2828
{
2929
let mut mir = ::std::io::Cursor::new(Vec::new());
30-
crate::rustc_mir::util::write_mir_pretty(tcx, Some(inst.def_id()), &mut mir)
31-
.unwrap();
30+
crate::rustc_mir::util::write_mir_pretty(
31+
tcx,
32+
Some(inst.def_id()),
33+
&mut mir,
34+
).unwrap();
3235
String::from_utf8(mir.into_inner()).unwrap()
3336
}
3437
InstanceDef::Item(_)
@@ -436,12 +439,10 @@ fn trans_stmt<'a, 'tcx: 'a>(
436439
let res = fx.bcx.ins().icmp_imm(IntCC::Equal, val, 0);
437440
fx.bcx.ins().bint(types::I8, res)
438441
}
439-
ty::Uint(_) | ty::Int(_) => {
440-
fx.bcx.ins().bnot(val)
441-
}
442+
ty::Uint(_) | ty::Int(_) => fx.bcx.ins().bnot(val),
442443
_ => unimplemented!("un op Not for {:?}", layout.ty),
443444
}
444-
},
445+
}
445446
UnOp::Neg => match layout.ty.sty {
446447
ty::Int(_) => {
447448
let clif_ty = fx.cton_type(layout.ty).unwrap();
@@ -1001,7 +1002,10 @@ fn trans_ptr_binop<'a, 'tcx: 'a>(
10011002
let res = match bin_op {
10021003
BinOp::Eq => fx.bcx.ins().icmp(IntCC::Equal, lhs, rhs),
10031004
BinOp::Ne => fx.bcx.ins().icmp(IntCC::NotEqual, lhs, rhs),
1004-
_ => unimplemented!("trans_ptr_binop({:?}, <fat ptr>, <fat ptr>) not implemented", bin_op),
1005+
_ => unimplemented!(
1006+
"trans_ptr_binop({:?}, <fat ptr>, <fat ptr>) not implemented",
1007+
bin_op
1008+
),
10051009
};
10061010

10071011
assert_eq!(fx.tcx.types.bool, ret_ty);

src/common.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ impl<'a, 'tcx: 'a> CPlace<'tcx> {
372372
pub fn write_cvalue(self, fx: &mut FunctionCx<'a, 'tcx, impl Backend>, from: CValue<'tcx>) {
373373
match (&self.layout().ty.sty, &from.layout().ty.sty) {
374374
(ty::Ref(_, t, dest_mut), ty::Ref(_, u, src_mut))
375-
if (if *dest_mut != crate::rustc::hir::Mutability::MutImmutable && src_mut != dest_mut {
375+
if (if *dest_mut != crate::rustc::hir::Mutability::MutImmutable
376+
&& src_mut != dest_mut
377+
{
376378
false
377379
} else if t != u {
378380
false
@@ -449,7 +451,11 @@ impl<'a, 'tcx: 'a> CPlace<'tcx> {
449451
) -> CPlace<'tcx> {
450452
match self {
451453
CPlace::Var(var, layout) => {
452-
bug!("Tried to project {:?}, which is put in SSA var {:?}", layout.ty, var);
454+
bug!(
455+
"Tried to project {:?}, which is put in SSA var {:?}",
456+
layout.ty,
457+
var
458+
);
453459
}
454460
CPlace::Addr(base, extra, layout) => {
455461
let (field_ptr, field_layout) = codegen_field(fx, base, layout, field);

src/constant.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ fn data_id_for_static<'a, 'tcx: 'a, B: Backend>(
154154
def_id: DefId,
155155
) -> DataId {
156156
let symbol_name = tcx.symbol_name(Instance::mono(tcx, def_id)).as_str();
157-
let is_mutable = if let crate::rustc::hir::Mutability::MutMutable = tcx.is_static(def_id).unwrap() {
157+
let is_mutable =
158+
if let crate::rustc::hir::Mutability::MutMutable = tcx.is_static(def_id).unwrap() {
158159
true
159160
} else {
160161
!tcx.type_of(def_id)
@@ -235,11 +236,13 @@ fn define_all_allocs<'a, 'tcx: 'a, B: Backend + 'a>(
235236
let data_id = match tcx.alloc_map.lock().get(reloc).unwrap() {
236237
AllocType::Function(instance) => {
237238
let (func_name, sig) = crate::abi::get_function_name_and_sig(tcx, instance);
238-
let func_id = module.declare_function(&func_name, Linkage::Import, &sig).unwrap();
239+
let func_id = module
240+
.declare_function(&func_name, Linkage::Import, &sig)
241+
.unwrap();
239242
let local_func_id = module.declare_func_in_data(func_id, &mut data_ctx);
240243
data_ctx.write_function_addr(reloc_offset as u32, local_func_id);
241244
continue;
242-
},
245+
}
243246
AllocType::Memory(_) => {
244247
cx.todo.insert(TodoItem::Alloc(reloc));
245248
data_id_for_alloc_id(module, reloc)

src/vtable.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ fn build_vtable<'a, 'tcx: 'a>(
8181
.layout_of(ParamEnv::reveal_all().and(ty))
8282
.unwrap()
8383
.size_and_align();
84-
let drop_in_place_fn =
85-
fx.get_function_id(crate::rustc_mir::monomorphize::resolve_drop_in_place(tcx, ty));
84+
let drop_in_place_fn = fx.get_function_id(
85+
crate::rustc_mir::monomorphize::resolve_drop_in_place(tcx, ty),
86+
);
8687

8788
let mut components: Vec<_> = vec![Some(drop_in_place_fn), None, None];
8889

0 commit comments

Comments
 (0)