[][src]Static rustc_ap_rustc_session::lint::builtin::UNCONDITIONAL_PANIC

pub static  UNCONDITIONAL_PANIC: &Lint

The unconditional_panic lint detects an operation that will cause a panic at runtime.

Example

This example deliberately fails to compile
let x = 1 / 0;

{{produces}}

Explanation

This lint detects code that is very likely incorrect. When possible, the compiler will attempt to detect situations where code can be evaluated at compile-time to generate more efficient code. While evaluating such code, if it detects that the code will unconditionally panic, this usually indicates that it is doing something incorrectly. If this lint is allowed, then the code will not be evaluated at compile-time, and instead continue to generate code to evaluate at runtime, which may panic during runtime.