Skip to main content

MAX_EXPR_DEPTH

Constant MAX_EXPR_DEPTH 

Source
pub const MAX_EXPR_DEPTH: usize = 64;
Expand description

Maximum expression nesting depth the compiler will descend before erroring (guards the compiler’s own recursion against adversarial inputs). Debug builds allocate every match arm’s locals in compile_expr_into_inner’s frame — measured in the tens of KiB per nesting level as the compiler grows — so 64 keeps the worst case well inside a default 2 MiB test-thread stack while still exceeding any realistic expression depth. (An explicit-work-stack compiler would remove the native-stack coupling entirely; tracked as future work.)