Skip to main content

real_body

Function real_body 

Source
const fn real_body<'hir>(
    source: LoopSource,
    body: &'hir [Stmt<'hir>],
) -> &'hir [Stmt<'hir>]
Expand description

The user-written body of a loop, peeled out of the synthetic condition guard the AST lowering wraps it in. A for/while lowers to a single if (cond) { body } else break, its body holding the user statements (and, for a for, the next-step); a do-while appends an if (cond) continue else break after the user statements. Peeling these makes the guard’s break/continue and the next-step read for what they are, not as user control flow. A body that does not match the exact synthetic shape is returned unchanged.