panic_internals)Expand description
Panic support for core
The core library cannot define panicking, but it does declare panicking. This means that the functions inside of core are allowed to panic, but to be useful an upstream crate must define panicking for core to use. The current interface for panicking is:
fn panic_impl(pi: &core::panic::PanicInfo<'_>) -> !This definition allows for panicking with any general message, but it does not
allow for failing with a Box<Any> value. (PanicInfo just contains a &(dyn Any + Send),
for which we fill in a dummy value in PanicInfo::internal_constructor.)
The reason for this is that core is not allowed to allocate.
This module contains a few other panicking functions, but these are just the
necessary lang items for the compiler. All panics are funneled through this
one function. The actual symbol is declared through the #[panic_handler] attribute.
Modules§
- panic_constExperimental
Functions§
- const_panic_fmtExperimentalThis function is used instead of panic_fmt in const eval.
- panicExperimentalThe underlying implementation of core’spanic!macro when no formatting is used.
- panic_displayExperimental
- panic_explicitExperimental
- panic_fmtExperimentalThe entry point for panicking with a formatted message.
- panic_nounwindExperimentalLikepanic, but without unwinding and track_caller to reduce the impact on codesize on the caller. If you want#[track_caller]for nicer errors, callpanic_nounwind_fmtdirectly.
- panic_nounwind_fmtExperimentalLikepanic_fmt, but for non-unwinding panics.
- panic_nounwind_nobacktraceExperimentalLikepanic_nounwind, but also inhibits showing a backtrace.
- panic_str_2015ExperimentalThis exists solely for the 2015 editionpanic!macro to trigger a lint onpanic!(my_str_variable);.
- unreachable_displayExperimental