pub struct Arm {
pub pattern: Pattern,
pub guard: Option<Core>,
pub body: Core,
pub span: Span,
}Expand description
One arm of a match. Patterns are shallow — a constructor and its named field binders — which
is what §3.1’s exhaustiveness check needs and no more.
Fields§
§pattern: Pattern§guard: Option<Core>case Circle(r) if r > 0: — a condition on the arm, in the scope of what the pattern bound.
A guard that fails falls through to the next arm, which is what makes it a guard rather
than an if in the body.
body: Core§span: SpanImplementations§
Source§impl Arm
impl Arm
Sourcepub fn exprs(&self) -> impl Iterator<Item = &Core>
pub fn exprs(&self) -> impl Iterator<Item = &Core>
Every expression this arm holds, in the order they run.
One method rather than &a.body at each of fourteen call sites, for
Pattern::binders’s reason and with its history: a guard added as a field those sites
did not know about would be a Core that liveness never marks, that frames never counts
a slot for, and that the plan’s free-variable analysis never sees — none of which is a
compile error, and all of which are wrong on a program that uses one.