I'm trying to implement an OS in Rust using libcore. In the documentation, it says that the eh_personality
function needs to be implemented.
However, I see no usage of this function in libcore itself and I am able to compile, run, and execute panics without it.
Is there something I'm missing here? Where does eh_personality
get called during the panic!()
cycle?
See unstable-book: lang_items:
The first of these functions,
rust_eh_personality
, is used by the failure mechanisms of the compiler. This is often mapped to GCC's personality function (see the libstd implementation for more information), but crates which do not trigger a panic can be assured that this function is never called. The language item's name iseh_personality
.
As far as I can tell it is required to create unwind information; if you abort or loop in the panic_fmt
language item (function rust_begin_unwind
) it probably doesn't get called.
Also see the internal comments in libpanic_abort/lib.rs.
If you search for rust_eh_personality
you'll find a usage in librustc_trans/context.rs: CodegenCx::eh_personality
. Searching for eh_personality
should reveal the places this function is called. (It is used for code generation, not a direct call.)
Searching for #[lang = "eh_personality"]
only shows the places where a personality is defined, not the usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With