Simplify the unwind crate#159010
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@xobs would you be able to check if the second commit doesn't break Xous? |
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/miri |
|
|
||
| #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] | ||
| pub const unwinder_private_data_size: usize = 2; | ||
| const unwinder_private_data_size: usize = cfg_select! { |
There was a problem hiding this comment.
Given that this is apparently mentioned in a public type, shouldn't this be public?
There was a problem hiding this comment.
Users don't need to care about the exact value. They just need to produce an array of the correct length that the unwinder can later fill with whatever data it needs, which can be done using [0; _]. The size of this array is just an implementation detail of the unwinder that happens to be part of the ABI.
There was a problem hiding this comment.
It's apparently part of the public API/ABI so I see no benefit to making it private here.
There was a problem hiding this comment.
llvm-libunwind doesn't consider private to be part of the public api. It has a bunch of private_* and reserved fields in the place with varying sizes and without any unwinder_private_data_size const: https://github.com/llvm/llvm-project/blob/06499c927e5012166f4553c58f8af593521ea14d/libunwind/include/unwind_itanium.h#L25-L37 _Unwind_Exception isn't meant to be constructed using _Unwind_Exception { field1, field2, field3 }, but rather by allocating memory for the exception object and then initializing select fields. I could change panic_unwind to do that too and then make the field private.
Use cfg_select! and unify type definitions.