[−][src]Enum rustc_mir_build::thir::pattern::usefulness::Usefulness

pub(crate) enum Usefulness<'tcx> {
    Useful(SpanSet),
    UsefulWithWitness(Vec<Witness<'tcx>>),
    NotUseful,
}

Variants

Useful(SpanSet)

Pontentially carries a set of sub-branches that have been found to be unreachable. Used only in the presence of or-patterns, otherwise it stays empty.

UsefulWithWitness(Vec<Witness<'tcx>>)

Carries a list of witnesses of non-exhaustiveness.

NotUseful

Implementations

impl<'tcx> Usefulness<'tcx>[src]

fn new_useful(preference: WitnessPreference) -> Self[src]

fn merge(usefulnesses: impl Iterator<Item = Self>) -> Self[src]

When trying several branches and each returns a Usefulness, we need to combine the results together.

fn unsplit_or_pat(self, this_span: Span, or_pat_spans: &[Span]) -> Self[src]

After calculating the usefulness for a branch of an or-pattern, call this to make this usefulness mergeable with those from the other branches.

fn apply_constructor<'p>(
    self,
    pcx: PatCtxt<'_, 'p, 'tcx>,
    matrix: &Matrix<'p, 'tcx>,
    ctor: &Constructor<'tcx>,
    ctor_wild_subpatterns: &Fields<'p, 'tcx>
) -> Self
[src]

After calculating usefulness after a specialization, call this to recontruct a usefulness that makes sense for the matrix pre-specialization. This new usefulness can then be merged with the results of specializing with the other constructors.

Trait Implementations

impl<'tcx> Clone for Usefulness<'tcx>[src]

impl<'tcx> Debug for Usefulness<'tcx>[src]

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for Usefulness<'tcx>[src]

impl<'tcx> !Send for Usefulness<'tcx>[src]

impl<'tcx> !Sync for Usefulness<'tcx>[src]

impl<'tcx> Unpin for Usefulness<'tcx>[src]

impl<'tcx> !UnwindSafe for Usefulness<'tcx>[src]

Blanket Implementations

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

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.