Struct rustc_mir_build::thir::pattern::usefulness::PatStack
source · [−]pub(crate) struct PatStack<'p, 'tcx> {
pub(crate) pats: SmallVec<[&'p DeconstructedPat<'p, 'tcx>; 2]>,
}
Expand description
A row of a matrix. Rows of len 1 are very common, which is why SmallVec[_; 2]
works well.
Fields
pats: SmallVec<[&'p DeconstructedPat<'p, 'tcx>; 2]>
Implementations
sourceimpl<'p, 'tcx> PatStack<'p, 'tcx>
impl<'p, 'tcx> PatStack<'p, 'tcx>
fn from_pattern(pat: &'p DeconstructedPat<'p, 'tcx>) -> Self
fn from_vec(vec: SmallVec<[&'p DeconstructedPat<'p, 'tcx>; 2]>) -> Self
fn is_empty(&self) -> bool
fn len(&self) -> usize
fn head(&self) -> &'p DeconstructedPat<'p, 'tcx>
fn iter(&self) -> impl Iterator<Item = &DeconstructedPat<'p, 'tcx>>
fn expand_or_pat<'a>(
&'a self
) -> impl Iterator<Item = PatStack<'p, 'tcx>> + Captures<'a>
fn expand_and_extend<'a>(&'a self, matrix: &mut Matrix<'p, 'tcx>)
sourcefn pop_head_constructor(
&self,
pcx: &PatCtxt<'_, 'p, 'tcx>,
ctor: &Constructor<'tcx>
) -> PatStack<'p, 'tcx>
fn pop_head_constructor(
&self,
pcx: &PatCtxt<'_, 'p, 'tcx>,
ctor: &Constructor<'tcx>
) -> PatStack<'p, 'tcx>
This computes S(self.head().ctor(), self)
. See top of the file for explanations.
Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing fields filled with wild patterns.
This is roughly the inverse of Constructor::apply
.
Trait Implementations
Auto Trait Implementations
impl<'p, 'tcx> !RefUnwindSafe for PatStack<'p, 'tcx>
impl<'p, 'tcx> !Send for PatStack<'p, 'tcx>
impl<'p, 'tcx> !Sync for PatStack<'p, 'tcx>
impl<'p, 'tcx> Unpin for PatStack<'p, 'tcx>where
'tcx: 'p,
impl<'p, 'tcx> !UnwindSafe for PatStack<'p, 'tcx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn 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: 24 bytes