Struct rustc_mir_build::thir::pattern::usefulness::PatStack[−][src]

struct PatStack<'p, 'tcx> {
    pats: SmallVec<[&'p Pat<'tcx>; 2]>,
    head_ctor: OnceCell<Constructor<'tcx>>,
}
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 Pat<'tcx>; 2]>head_ctor: OnceCell<Constructor<'tcx>>
Expand description

Cache for the constructor of the head

Implementations

impl<'p, 'tcx> PatStack<'p, 'tcx>[src]

fn from_pattern(pat: &'p Pat<'tcx>) -> Self[src]

fn from_vec(vec: SmallVec<[&'p Pat<'tcx>; 2]>) -> Self[src]

fn is_empty(&self) -> bool[src]

fn len(&self) -> usize[src]

fn head(&self) -> &'p Pat<'tcx>[src]

fn head_ctor<'a>(
    &'a self,
    cx: &MatchCheckCtxt<'p, 'tcx>
) -> &'a Constructor<'tcx>
[src]

fn iter(&self) -> impl Iterator<Item = &Pat<'tcx>>[src]

fn expand_or_pat<'a>(
    &'a self
) -> impl Iterator<Item = PatStack<'p, 'tcx>> + Captures<'a>
[src]

fn pop_head_constructor(
    &self,
    ctor_wild_subpatterns: &Fields<'p, 'tcx>
) -> PatStack<'p, 'tcx>
[src]

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

impl<'p, 'tcx> Clone for PatStack<'p, 'tcx>[src]

fn clone(&self) -> PatStack<'p, 'tcx>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'p, 'tcx> Debug for PatStack<'p, 'tcx>[src]

Pretty-printing for matrix row.

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'p, 'tcx> Default for PatStack<'p, 'tcx>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<'p, 'tcx> FromIterator<&'p Pat<'tcx>> for PatStack<'p, 'tcx>[src]

fn from_iter<T>(iter: T) -> Self where
    T: IntoIterator<Item = &'p Pat<'tcx>>, 
[src]

Creates a value from an iterator. Read more

impl<'p, 'tcx> FromIterator<PatStack<'p, 'tcx>> for Matrix<'p, 'tcx>[src]

fn from_iter<T>(iter: T) -> Self where
    T: IntoIterator<Item = PatStack<'p, 'tcx>>, 
[src]

Creates a value from an iterator. Read more

impl<'p, 'tcx> PartialEq<PatStack<'p, 'tcx>> for PatStack<'p, 'tcx>[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]