pub static UNSAFE_PANIC_HANDLERS: &LintExpand description
The unsafe_panic_handlers lint detects unsafe functions with
the #[panic_handler] attribute.
§Example
ⓘ
#![no_std]
use core::panic::PanicInfo;
#[panic_handler]
unsafe fn handle(_: &PanicInfo<'_>) -> ! {
loop {}
}{{produces}}
§Explanation
Unsafe functions (declared as unsafe fn) are functions that can only be called
when the caller ensures that their safety requirements are met. On the other hand,
#[panic_handler] functions get called automatically by the compiler without
checking for any preconditions. Therefore, using the #[panic_handler] attribute
on unsafe functions is either incorrect or a misuse of unsafe fn.
This is a [future-incompatible] lint to transition this to a hard error in the future. See issue #163263 for more details.