Struct rustc_pattern_analysis::pat::WitnessPat
source · pub struct WitnessPat<'tcx> {
ctor: Constructor<'tcx>,
pub(crate) fields: Vec<WitnessPat<'tcx>>,
ty: Ty<'tcx>,
}Expand description
Same idea as DeconstructedPat, except this is a fictitious pattern built up for diagnostics
purposes. As such they don’t use interning and can be cloned.
Fields§
§ctor: Constructor<'tcx>§fields: Vec<WitnessPat<'tcx>>§ty: Ty<'tcx>Implementations§
source§impl<'tcx> WitnessPat<'tcx>
impl<'tcx> WitnessPat<'tcx>
pub(crate) fn new( ctor: Constructor<'tcx>, fields: Vec<Self>, ty: Ty<'tcx> ) -> Self
pub(crate) fn wildcard(ty: Ty<'tcx>) -> Self
sourcepub(crate) fn wild_from_ctor(
pcx: &PatCtxt<'_, '_, 'tcx>,
ctor: Constructor<'tcx>
) -> Self
pub(crate) fn wild_from_ctor( pcx: &PatCtxt<'_, '_, 'tcx>, ctor: Constructor<'tcx> ) -> Self
Construct a pattern that matches everything that starts with this constructor.
For example, if ctor is a Constructor::Variant for Option::Some, we get the pattern
Some(_).
pub fn ctor(&self) -> &Constructor<'tcx>
pub fn ty(&self) -> Ty<'tcx>
pub fn iter_fields<'a>(&'a self) -> impl Iterator<Item = &'a WitnessPat<'tcx>>
Trait Implementations§
source§impl<'tcx> Clone for WitnessPat<'tcx>
impl<'tcx> Clone for WitnessPat<'tcx>
source§fn clone(&self) -> WitnessPat<'tcx>
fn clone(&self) -> WitnessPat<'tcx>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'tcx> !RefUnwindSafe for WitnessPat<'tcx>
impl<'tcx> Send for WitnessPat<'tcx>
impl<'tcx> Sync for WitnessPat<'tcx>
impl<'tcx> Unpin for WitnessPat<'tcx>
impl<'tcx> !UnwindSafe for WitnessPat<'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
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