pub enum MirPattern {
Wildcard,
Literal(Literal),
Bind(LocalId, String),
EmptyList,
Cons {
head: LocalId,
head_name: String,
tail: LocalId,
tail_name: String,
},
Tuple(Vec<MirPattern>),
Ctor {
ctor: MirCtor,
bindings: Vec<LocalId>,
binding_names: Vec<String>,
},
}Expand description
Pattern shape for match arms. Identity-typed where applicable
(constructor patterns reference CtorId); LocalId is the
fresh local introduced by the binding form.
Variants§
Wildcard
_ — catch-all, binds nothing.
Literal(Literal)
Literal arm: 0, true, "foo".
Bind(LocalId, String)
Identifier binding — captures the matched value into a
fresh local accessible in the arm body. The String
carries the source-level binder name (Phase 5 prep) so
Rust / wasm-gc walkers can emit the binding ident.
EmptyList
[] — empty-list pattern.
Cons
[head, ..tail] — cons pattern; both bindings fresh.
head_name / tail_name carry the source idents (Phase 5
prep) for backends that emit named locals.
Tuple(Vec<MirPattern>)
(a, b, c) — tuple pattern; each component is a sub-pattern.
Ctor
Module.Variant(b1, b2, …) / Result.Ok(b) / Option.None
— constructor pattern. ctor discriminates user vs built-in
variant via MirCtor; bindings are the fresh locals for
the variant’s fields in declaration order (empty for
nullary variants like Option.None). binding_names is a
parallel array of source idents (Phase 5 prep) — same
length as bindings.
Trait Implementations§
Source§impl Clone for MirPattern
impl Clone for MirPattern
Source§fn clone(&self) -> MirPattern
fn clone(&self) -> MirPattern
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more