Struct rustc_pattern_analysis::usefulness::MatrixRow
source · struct MatrixRow<'a, 'p, Cx: TypeCx> {
pats: PatStack<'a, 'p, Cx>,
is_under_guard: bool,
parent_row: usize,
useful: bool,
}Expand description
A row of the matrix.
Fields§
§pats: PatStack<'a, 'p, Cx>§is_under_guard: boolWhether the original arm had a guard. This is inherited when specializing.
parent_row: usizeWhen we specialize, we remember which row of the original matrix produced a given row of the specialized matrix. When we unspecialize, we use this to propagate usefulness back up the callstack.
useful: boolFalse when the matrix is just built. This is set to true by
compute_exhaustiveness_and_usefulness if the arm is found to be useful.
This is reset to false when specializing.
Implementations§
source§impl<'a, 'p, Cx: TypeCx> MatrixRow<'a, 'p, Cx>
impl<'a, 'p, Cx: TypeCx> MatrixRow<'a, 'p, Cx>
fn is_empty(&self) -> bool
fn len(&self) -> usize
fn head(&self) -> &'a DeconstructedPat<'p, Cx>
fn iter<'b>( &'b self ) -> impl Iterator<Item = &'a DeconstructedPat<'p, Cx>> + Captures<'b>
fn expand_or_pat<'b>( &'b self ) -> impl Iterator<Item = MatrixRow<'a, 'p, Cx>> + Captures<'b>
sourcefn pop_head_constructor(
&self,
pcx: &PlaceCtxt<'a, 'p, Cx>,
ctor: &Constructor<Cx>,
parent_row: usize
) -> MatrixRow<'a, 'p, Cx>
fn pop_head_constructor( &self, pcx: &PlaceCtxt<'a, 'p, Cx>, ctor: &Constructor<Cx>, parent_row: usize ) -> MatrixRow<'a, '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<'a, 'p, Cx> !RefUnwindSafe for MatrixRow<'a, 'p, Cx>
impl<'a, 'p, Cx> !Send for MatrixRow<'a, 'p, Cx>
impl<'a, 'p, Cx> !Sync for MatrixRow<'a, 'p, Cx>
impl<'a, 'p, Cx> Unpin for MatrixRow<'a, 'p, Cx>
impl<'a, 'p, Cx> !UnwindSafe for MatrixRow<'a, '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
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: 40 bytes