Struct rustc_pattern_analysis::usefulness::PatStack
source · struct PatStack<'p, Cx: TypeCx> {
pats: SmallVec<[PatOrWild<'p, Cx>; 2]>,
relevant: bool,
}Expand description
Represents a pattern-tuple under investigation.
Fields§
§pats: SmallVec<[PatOrWild<'p, Cx>; 2]>§relevant: boolSometimes we know that as far as this row is concerned, the current case is already handled by a different, more general, case. When the case is irrelevant for all rows this allows us to skip a case entirely. This is purely an optimization. See at the top for details.
Implementations§
source§impl<'p, Cx: TypeCx> PatStack<'p, Cx>
impl<'p, Cx: TypeCx> PatStack<'p, Cx>
fn from_pattern(pat: &'p DeconstructedPat<'p, Cx>) -> Self
fn is_empty(&self) -> bool
fn len(&self) -> usize
fn head(&self) -> PatOrWild<'p, Cx>
fn iter(&self) -> impl Iterator<Item = PatOrWild<'p, Cx>> + Captures<'_>
fn expand_or_pat(&self) -> impl Iterator<Item = PatStack<'p, Cx>> + Captures<'_>
sourcefn pop_head_constructor(
&self,
ctor: &Constructor<Cx>,
ctor_arity: usize,
ctor_is_relevant: bool
) -> PatStack<'p, Cx>
fn pop_head_constructor( &self, ctor: &Constructor<Cx>, ctor_arity: usize, ctor_is_relevant: bool ) -> PatStack<'p, Cx>
This computes specialize(ctor, self). See top of the file for explanations.
Only call if ctor.is_covered_by(self.head().ctor()) is true.
Trait Implementations§
Auto Trait Implementations§
impl<'p, Cx> !RefUnwindSafe for PatStack<'p, Cx>
impl<'p, Cx> !Send for PatStack<'p, Cx>
impl<'p, Cx> !Sync for PatStack<'p, Cx>
impl<'p, Cx> Unpin for PatStack<'p, Cx>
impl<'p, Cx> !UnwindSafe for PatStack<'p, Cx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes