Skip to main content

panic_message_with_location

Function panic_message_with_location 

Source
pub(crate) fn panic_message_with_location(payload: &(dyn Any + Send)) -> String
Expand description

Stringify a panic payload and fold in the Rust source location the panic hook recorded on the current thread, producing the final R-facing message.

Returns panic_payload_to_string(payload) with a \n(at file:line) suffix when crate::backtrace::take_last_panic_location has a location for this thread, otherwise the bare message. The location is captured in the process panic hook (backtrace.rs), which fires on the panicking thread — so this must be called on the same thread that ran the panicking closure (main for main-thread #[miniextendr] fns; the worker for worker-dispatched fns).

Only the generic panic path uses this. error!/warning!/message!/ condition! (and Result::Err / Option::None) travel the typed RCondition / tagged-value branches and are deliberately left byte-for-byte unchanged — they carry no location suffix.