Skip to main content

guard_nesting

Function guard_nesting 

Source
pub fn guard_nesting(source: &str) -> Result<(), FaceSyntaxError>
Expand description

Refuse a source whose nesting would overflow syn, for callers that parse text themselves. 对自行解析文本的调用方:拒绝一份嵌套会让 syn 栈溢出的源码。

parse_file applies this to every syn::parse_file in this crate. It is public because it is the only nesting measurement in the workspace: the documentation gate in conventions hands fenced Rust to syn too, and a pathological fence would abort that gate’s process rather than fail it. A second copy of the heuristic there would be a second thing to keep honest; asking the kernel keeps one. parse_file 把本函数施加于本 crate 里每一处 syn::parse_file。它公开是因为它是本工作区 唯一的嵌套度量:conventions 里的文档门禁也会把围栏 Rust 交给 syn,而一份病态围栏 会让那道门禁的进程 abort 而不是失败。在那里复制一份启发式就等于多一个需要保持诚实的东西; 向内核发问则只有一份。