Enum rustc_mir_build::build::matches::TestCase
source · enum TestCase<'pat, 'tcx> {
Irrefutable {
binding: Option<Binding<'tcx>>,
ascription: Option<Ascription<'tcx>>,
},
Variant {
adt_def: AdtDef<'tcx>,
variant_index: VariantIdx,
},
Constant {
value: Const<'tcx>,
},
Range(&'pat PatRange<'tcx>),
Slice {
len: usize,
variable_length: bool,
},
Deref {
temp: Place<'tcx>,
mutability: Mutability,
},
Never,
Or {
pats: Box<[FlatPat<'pat, 'tcx>]>,
},
}
Expand description
Partial summary of a thir::Pat
, indicating what sort of test should be
performed to match/reject the pattern, and what the desired test outcome is.
This avoids having to perform a full match on thir::PatKind
in some places,
and helps TestKind::Switch
and TestKind::SwitchInt
know what target
values to use.
Created by MatchPairTree::for_pattern
, and then inspected primarily by:
Builder::pick_test_for_match_pair
(to choose a test)Builder::sort_candidate
(to see how the test interacts with a match pair)
Two variants are unlike the others and deserve special mention:
Self::Irrefutable
is only used temporarily when building aMatchPairTree
. They are then flattened away byBuilder::simplify_match_pairs
, with any bindings/ascriptions incorporated into the enclosingFlatPat
.Self::Or
are not tested directly like the other variants. Instead they participate in or-pattern expansion, where they are transformed into subcandidates.
Variants§
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'pat, 'tcx> Freeze for TestCase<'pat, 'tcx>
impl<'pat, 'tcx> !RefUnwindSafe for TestCase<'pat, 'tcx>
impl<'pat, 'tcx> !Send for TestCase<'pat, 'tcx>
impl<'pat, 'tcx> !Sync for TestCase<'pat, 'tcx>
impl<'pat, 'tcx> Unpin for TestCase<'pat, 'tcx>
impl<'pat, 'tcx> !UnwindSafe for TestCase<'pat, 'tcx>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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: 88 bytes
Size for each variant:
Irrefutable
: 88 bytesVariant
: 16 bytesConstant
: 40 bytesRange
: 8 bytesSlice
: 16 bytesDeref
: 24 bytesNever
: 0 bytesOr
: 16 bytes