Skip to main content

MAX_NESTING_DEPTH

Constant MAX_NESTING_DEPTH 

Source
pub const MAX_NESTING_DEPTH: usize = 256;
Available on crate feature parser only.
Expand description

The maximum nesting depth the parser supports.

The parser (and lowering, and many passes over the AST) are recursive, so this limit keeps deeply nested source code from overflowing the stack. Nesting includes delimiters ((, [, {), else if chains, and chains of operators in a single expression (since a + b + c is nested as (a + b) + c). Source code nested more deeply than this produces an error.