Skip to main content

MAX_CALL_CHAIN

Constant MAX_CALL_CHAIN 

Source
pub const MAX_CALL_CHAIN: usize = 8;
Expand description

How many call-site spans RuntimeError::with_chain keeps, innermost first.

A bound rather than the whole call stack, because the chain is built for every error whether the recursion behind it was three frames deep or the tree-walking interpreter’s 256-frame limit — and a diagnostic naming 256 callers would be unreadable long before it is untruthful. Eight is enough to show a handful of library layers above the fault and to say, honestly, that there were more: it is not derived from anything else that is eight, it is simply small enough that a chain this long is already a wall of --> blocks rather than a hint.