rustc_lint::builtin

Static LONG_RUNNING_CONST_EVAL

Source
pub static LONG_RUNNING_CONST_EVAL: &'static Lint
Expand description

The long_running_const_eval lint is emitted when const eval is running for a long time to ensure rustc terminates even if you accidentally wrote an infinite loop.

§Example

const FOO: () = loop {};

{{produces}}

§Explanation

Loops allow const evaluation to compute arbitrary code, but may also cause infinite loops or just very long running computations. Users can enable long running computations by allowing the lint on individual constants or for entire crates.

§Unconditional warnings

Note that regardless of whether the lint is allowed or set to warn, the compiler will issue warnings if constant evaluation runs significantly longer than this lint’s limit. These warnings are also shown to downstream users from crates.io or similar registries. If you are above the lint’s limit, both you and downstream users might be exposed to these warnings. They might also appear on compiler updates, as the compiler makes minor changes about how complexity is measured: staying below the limit ensures that there is enough room, and given that the lint is disabled for people who use your dependency it means you will be the only one to get the warning and can put out an update in your own time.