pub struct Region {
pub label: LabelId,
pub name: String,
pub kind: RegionKind,
pub body: Vec<Stmt>,
pub falls_out: bool,
pub range: SourceRange,
}Expand description
A labelled region a goto leaves or restarts.
The statements a C label divides are wrapped in one of these when every
goto to that label is a jump Rust can make on its own; see
regions for which jumps those are and how the
boundaries are chosen. Code generation emits a labelled block or a labelled
loop, named after the C label:
'done: { … break 'done; … } 'retry: loop { … continue 'retry; … break 'retry; }Fields§
§label: LabelIdThe label the region belongs to, which the gotos inside it name.
name: StringThe label’s name in C, which the generated Rust label is built from.
kind: RegionKindWhether a goto to it leaves the region or restarts it.
body: Vec<Stmt>The statements inside.
falls_out: boolWhether control can reach the end of body, so that a
loop needs a break there to leave it. A loop
without one is a Rust loop that never finishes, which is what makes a
function ending in it need no return.
range: SourceRangeWhere the label was written.