[][src]Function rustc_mir::hair::pattern::_match::specialize

fn specialize<'p, 'a: 'p, 'tcx: 'a>(
    cx: &mut MatchCheckCtxt<'a, 'tcx>,
    r: &[&'p Pattern<'tcx>],
    constructor: &Constructor<'tcx>,
    wild_patterns: &[&'p Pattern<'tcx>]
) -> Option<Vec<&'p Pattern<'tcx>>>
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

This is the main specialization step. It expands the first pattern in the given row into arity patterns based on the constructor. For most patterns, the step is trivial, for instance tuple patterns are flattened and box patterns expand into their inner pattern.

OTOH, slice patterns with a subslice pattern (..tail) can be expanded into multiple different patterns. Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing fields filled with wild patterns.