Skip to content

Commit

Permalink
cargo fmt from rustc 1.51
Browse files Browse the repository at this point in the history
  • Loading branch information
ailisp committed Apr 21, 2021
1 parent b4056da commit c7ee2aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
11 changes: 9 additions & 2 deletions lib/engine-jit/src/unwind/systemv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ extern "C" {
impl UnwindRegistry {
/// Creates a new unwind registry with the given base address.
pub fn new() -> Self {
Self { registrations: Vec::new(), published: false }
Self {
registrations: Vec::new(),
published: false,
}
}

/// Registers a function given the start offset, length, and unwind information.
Expand Down Expand Up @@ -65,7 +68,11 @@ impl UnwindRegistry {
// deregistering it. We must avoid this
// scenario. Usually, this is handled upstream by the
// compilers.
debug_assert_ne!(eh_frame, &[0, 0, 0, 0], "`eh_frame` seems to contain empty FDEs");
debug_assert_ne!(
eh_frame,
&[0, 0, 0, 0],
"`eh_frame` seems to contain empty FDEs"
);

// On gnu (libgcc), `__register_frame` will walk the FDEs until an entry of length 0
let ptr = eh_frame.as_ptr();
Expand Down
15 changes: 12 additions & 3 deletions lib/engine-jit/src/unwind/windows_x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ pub struct UnwindRegistry {
impl UnwindRegistry {
/// Creates a new unwind registry with the given base address.
pub fn new() -> Self {
Self { functions: HashMap::new(), published: false }
Self {
functions: HashMap::new(),
published: false,
}
}

/// Registers a function given the start offset, length, and unwind information.
Expand Down Expand Up @@ -47,7 +50,10 @@ impl UnwindRegistry {
unsafe {
*entry.u.UnwindInfoAddress_mut() = (entry.EndAddress + 3) & !3;
}
let entries = self.functions.entry(base_address).or_insert_with(|| Vec::new());
let entries = self
.functions
.entry(base_address)
.or_insert_with(|| Vec::new());

entries.push(entry);

Expand Down Expand Up @@ -110,7 +116,10 @@ impl MemoryUsage for UnwindRegistry {
//
// [doc1]: https://docs.rs/winapi/0.3.9/winapi/um/winnt/type.RUNTIME_FUNCTION.html
// [doc2]: https://docs.rs/winapi/0.3.9/winapi/um/winnt/struct._IMAGE_RUNTIME_FUNCTION_ENTRY.html
self.functions.iter().map(|(_, _)| std::mem::size_of::<u64>() * 3).sum::<usize>()
self.functions
.iter()
.map(|(_, _)| std::mem::size_of::<u64>() * 3)
.sum::<usize>()
+ self.published.size_of_val(tracker)
}
}

0 comments on commit c7ee2aa

Please sign in to comment.