Skip to content

Commit c352f91

Browse files
committed
Rustfmt
1 parent e910a24 commit c352f91

File tree

5 files changed

+28
-46
lines changed

5 files changed

+28
-46
lines changed

src/bin/cg_clif.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ fn main() {
8181
None,
8282
Some(Box::new(move |_| {
8383
Box::new(rustc_codegen_cranelift::CraneliftCodegenBackend {
84-
config: rustc_codegen_cranelift::BackendConfig {
85-
use_jit,
86-
}
84+
config: rustc_codegen_cranelift::BackendConfig { use_jit },
8785
})
8886
})),
8987
)

src/debuginfo/emit.rs

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ impl WriterRelocate {
8484
match reloc.name {
8585
super::DebugRelocName::Section(_) => unreachable!(),
8686
super::DebugRelocName::Symbol(sym) => {
87-
let addr = jit_product.lookup_func(
88-
cranelift_module::FuncId::from_u32(sym.try_into().unwrap()),
89-
);
87+
let addr = jit_product
88+
.lookup_func(cranelift_module::FuncId::from_u32(sym.try_into().unwrap()));
9089
let val = (addr as u64 as i64 + reloc.addend) as u64;
9190
self.writer
9291
.write_udata_at(reloc.offset as usize, val, reloc.size)
@@ -163,12 +162,7 @@ impl Writer for WriterRelocate {
163162
self.write_udata_at(offset, 0, size)
164163
}
165164

166-
fn write_eh_pointer(
167-
&mut self,
168-
address: Address,
169-
eh_pe: gimli::DwEhPe,
170-
size: u8,
171-
) -> Result<()> {
165+
fn write_eh_pointer(&mut self, address: Address, eh_pe: gimli::DwEhPe, size: u8) -> Result<()> {
172166
match address {
173167
// Address::Constant arm copied from gimli
174168
Address::Constant(val) => {
@@ -186,27 +180,25 @@ impl Writer for WriterRelocate {
186180
};
187181
self.write_eh_pointer_data(val, eh_pe.format(), size)
188182
}
189-
Address::Symbol { symbol, addend } => {
190-
match eh_pe.application() {
191-
gimli::DW_EH_PE_pcrel => {
192-
let size = match eh_pe.format() {
193-
gimli::DW_EH_PE_sdata4 => 4,
194-
_ => return Err(gimli::write::Error::UnsupportedPointerEncoding(eh_pe)),
195-
};
196-
self.relocs.push(DebugReloc {
197-
offset: self.len() as u32,
198-
size,
199-
name: DebugRelocName::Symbol(symbol),
200-
addend,
201-
kind: object::RelocationKind::Relative,
202-
});
203-
self.write_udata(0, size)
204-
}
205-
_ => {
206-
return Err(gimli::write::Error::UnsupportedPointerEncoding(eh_pe));
207-
}
183+
Address::Symbol { symbol, addend } => match eh_pe.application() {
184+
gimli::DW_EH_PE_pcrel => {
185+
let size = match eh_pe.format() {
186+
gimli::DW_EH_PE_sdata4 => 4,
187+
_ => return Err(gimli::write::Error::UnsupportedPointerEncoding(eh_pe)),
188+
};
189+
self.relocs.push(DebugReloc {
190+
offset: self.len() as u32,
191+
size,
192+
name: DebugRelocName::Symbol(symbol),
193+
addend,
194+
kind: object::RelocationKind::Relative,
195+
});
196+
self.write_udata(0, size)
208197
}
209-
}
198+
_ => {
199+
return Err(gimli::write::Error::UnsupportedPointerEncoding(eh_pe));
200+
}
201+
},
210202
}
211203
}
212204
}

src/debuginfo/unwind.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ impl<'tcx> UnwindContext<'tcx> {
2020

2121
let cie_id = if let Some(mut cie) = isa.create_systemv_cie() {
2222
if isa.flags().is_pic() {
23-
cie.fde_address_encoding = gimli::DwEhPe(gimli::DW_EH_PE_pcrel.0 | gimli::DW_EH_PE_sdata4.0);
23+
cie.fde_address_encoding =
24+
gimli::DwEhPe(gimli::DW_EH_PE_pcrel.0 | gimli::DW_EH_PE_sdata4.0);
2425
}
2526
Some(frame_table.add_cie(cie))
2627
} else {

src/driver/jit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_codegen_ssa::CrateInfo;
99
use crate::prelude::*;
1010

1111
pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
12-
use cranelift_simplejit::{SimpleJITModule, SimpleJITBuilder};
12+
use cranelift_simplejit::{SimpleJITBuilder, SimpleJITModule};
1313

1414
#[cfg(unix)]
1515
unsafe {

src/trap.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl Module>, msg: &str) {
2929
}
3030

3131
/// Trap code: user1
32-
pub(crate) fn trap_abort(
33-
fx: &mut FunctionCx<'_, '_, impl Module>,
34-
msg: impl AsRef<str>,
35-
) {
32+
pub(crate) fn trap_abort(fx: &mut FunctionCx<'_, '_, impl Module>, msg: impl AsRef<str>) {
3633
codegen_print(fx, msg.as_ref());
3734
fx.bcx.ins().trap(TrapCode::User(1));
3835
}
@@ -41,10 +38,7 @@ pub(crate) fn trap_abort(
4138
/// so you can **not** add instructions to it afterwards.
4239
///
4340
/// Trap code: user65535
44-
pub(crate) fn trap_unreachable(
45-
fx: &mut FunctionCx<'_, '_, impl Module>,
46-
msg: impl AsRef<str>,
47-
) {
41+
pub(crate) fn trap_unreachable(fx: &mut FunctionCx<'_, '_, impl Module>, msg: impl AsRef<str>) {
4842
codegen_print(fx, msg.as_ref());
4943
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
5044
}
@@ -68,10 +62,7 @@ pub(crate) fn trap_unreachable_ret_value<'tcx>(
6862
/// to it afterwards.
6963
///
7064
/// Trap code: user65535
71-
pub(crate) fn trap_unimplemented(
72-
fx: &mut FunctionCx<'_, '_, impl Module>,
73-
msg: impl AsRef<str>,
74-
) {
65+
pub(crate) fn trap_unimplemented(fx: &mut FunctionCx<'_, '_, impl Module>, msg: impl AsRef<str>) {
7566
codegen_print(fx, msg.as_ref());
7667
let true_ = fx.bcx.ins().iconst(types::I32, 1);
7768
fx.bcx.ins().trapnz(true_, TrapCode::User(!0));

0 commit comments

Comments
 (0)