Skip to content

Commit dd31570

Browse files
committed
Make get_unwinder_private_word_count a constant
Also fixes Clippy's "panic in a function without 'Panics' section" warning.
1 parent b3cf73a commit dd31570

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/itanium.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ pub struct Header {
102102
cleanup: Option<unsafe extern "C" fn(i32, *mut Header)>,
103103
// See `new_header` for why this needs to be a separate field.
104104
private1: MaybeUninit<*const ()>,
105-
private_rest: MaybeUninit<[*const (); get_unwinder_private_word_count() - 1]>,
105+
private_rest: MaybeUninit<[*const (); UNWINDER_PRIVATE_WORD_COUNT - 1]>,
106106
}
107107

108108
// Data from https://github.com/rust-lang/rust/blob/master/library/unwind/src/libunwind.rs
109-
const fn get_unwinder_private_word_count() -> usize {
109+
const UNWINDER_PRIVATE_WORD_COUNT: usize = {
110110
// The Itanium EH ABI says the structure contains 2 private uint64_t words. Some architectures
111111
// decided this means "2 private native words". So on some 32-bit architectures this is two
112112
// 64-bit words, which together with padding amount to 5 native words, and on other
@@ -147,7 +147,7 @@ const fn get_unwinder_private_word_count() -> usize {
147147
} else {
148148
panic!("Unsupported architecture");
149149
}
150-
}
150+
};
151151

152152
/// Destruct an exception when caught by a foreign runtime.
153153
///

0 commit comments

Comments
 (0)