Skip to main content

compute_alloc_info

Function compute_alloc_info 

Source
pub fn compute_alloc_info<P: AllocPolicy>(
    fns: &[&FnDef],
    policy: &P,
) -> HashMap<String, bool>
Expand description

Compute per-fn allocation status for every fn in fns under policy.

Iterates to fixpoint: a fn is marked allocating if it has effects, if its body contains a direct allocation, or if it calls (transitively, via the existing info map) a user fn already classified as allocating. Mutual recursion is handled by repeating the pass until nothing changes.

Once a fn flips to true it never reverts, so the loop is monotone and converges in at most fns.len() iterations.