pub static CONST_ERR: &'static Lint
Expand description

The const_err lint detects an erroneous expression while doing constant evaluation.

Example

#![allow(unconditional_panic)]
const C: i32 = 1/0;

{{produces}}

Explanation

This lint detects constants that fail to evaluate. Allowing the lint will accept the constant declaration, but any use of this constant will still lead to a hard error. This is a future incompatibility lint; the plan is to eventually entirely forbid even declaring constants that cannot be evaluated. See issue #71800 for more details.