rustc_data_structures::stack

Function ensure_sufficient_stack

source
pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R
Expand description

Grows the stack on demand to prevent stack overflow. Call this in strategic locations to “break up” recursive calls. E.g. almost any call to visit_expr or equivalent can benefit from this.

Should not be sprinkled around carelessly, as it causes a little bit of overhead.