@gnzlbg in retrospect this makes sense, but also seems to indicate that a no_std dynamic library would potentially be in quite a bit of trouble.
Just trying to understand the possible cases here, it seems like:
-
std:
- The panic happens
- The panic_hook is executed
- The panic runtime is executed, which is either an unwind or an abort
-
no_std:
- The panic happens
- The program immediately jumps to the
panic_handler function and must never return.
Is this correct?
Assuming so, here’s two annoying questiond that Rust probably needs an answer to because it can happen:
- What happens if std rust code calls into a dynamic lib with no_std and a panic_handler? My guess, the lib uses its
panic_handler and never returns
- What happens if std Rust calls a std dynamic lib? will the right panic_hook get used? even across compiler versions? Guess: it’s probably totally broken if that happens?