rustc_mir_build::build::matches

Function traverse_candidate

Source
fn traverse_candidate<'pat, 'tcx: 'pat, C, T, I>(
    candidate: C,
    context: &mut T,
    visit_leaf: &mut impl FnMut(C, &mut T),
    get_children: impl Copy + Fn(C, &mut T) -> I,
    complete_children: impl Copy + Fn(&mut T),
)
where C: Borrow<Candidate<'pat, 'tcx>>, I: Iterator<Item = C>,
Expand description

A depth-first traversal of the Candidate and all of its recursive subcandidates.

This signature is very generic, to support traversing candidate trees by reference or by value, and to allow a mutable “context” to be shared by the traversal callbacks. Most traversals can use the simpler Candidate::visit_leaves wrapper instead.