MAX_STEPS

Constant MAX_STEPS 

Source
pub const MAX_STEPS: u64 = 1_000_000;
Expand description

How many steps one module’s macro bodies may take, in total.

The same shape as crate::MAX_EXPANSION and for the same reason: per module, because that is what a compile is, and a per-call budget would let a program spend it once per call site.

A step is an expression evaluated or a statement run, so the number is a bound on compile time rather than on a program’s size — which is what makes it the answer to while true: in a macro body. macro_interp.rs::a_macro_body_that_does_not_terminate_is_refused is the gate, and two measurements set the size: the_step_budget_is_far_above_what_a_real_macro_spends prints what the most expensive macro body here costs — 84 steps, so a million is about 12,000× the largest real one — and exhausting the whole budget costs under a second of beck check in an unoptimised build. It is the room a limit wants when what it separates is legitimate from absurd rather than big from small.