Skip to main content

MAX_PARSE_DEPTH

Constant MAX_PARSE_DEPTH 

Source
pub const MAX_PARSE_DEPTH: usize = 128;
Expand description

解析递归深度上限。超过即返回 ParserErr::TooDeep,把“栈溢出崩溃“降级为 普通解析错误。

单层 expr_with_min_weight 帧约 7KB,worker 线程默认栈仅 2MB,因此上限取 128(与 rustc 默认 recursion_limit 一致):128×7KB≈0.9MB,在最小栈上仍有 余量,而正常代码极少超过几十层嵌套。