rustc_middle::ty::data_structures

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.