rustc_pattern_analysis::rustc

Type Alias WitnessPat

Source
pub type WitnessPat<'p, 'tcx> = WitnessPat<RustcPatCtxt<'p, 'tcx>>;

Aliased Type§

struct WitnessPat<'p, 'tcx> {
    ctor: Constructor<RustcPatCtxt<'p, 'tcx>>,
    pub(crate) fields: Vec<WitnessPat<RustcPatCtxt<'p, 'tcx>>>,
    ty: RevealedTy<'tcx>,
}

Fields§

§ctor: Constructor<RustcPatCtxt<'p, 'tcx>>§fields: Vec<WitnessPat<RustcPatCtxt<'p, 'tcx>>>§ty: RevealedTy<'tcx>

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: 112 bytes

Implementations

Source§

impl<Cx: PatCx> WitnessPat<Cx>

Source

pub(crate) fn new(ctor: Constructor<Cx>, fields: Vec<Self>, ty: Cx::Ty) -> Self

Source

pub(crate) fn wildcard(cx: &Cx, ty: Cx::Ty) -> Self

Create a wildcard pattern for this type. If the type is empty, we create a ! pattern.

Source

pub(crate) fn wild_from_ctor(cx: &Cx, ctor: Constructor<Cx>, ty: Cx::Ty) -> 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(_).

Source

pub fn ctor(&self) -> &Constructor<Cx>

Source

pub fn ty(&self) -> &Cx::Ty

Source

pub fn is_never_pattern(&self) -> bool

Source

pub fn iter_fields(&self) -> impl Iterator<Item = &WitnessPat<Cx>>

Trait Implementations

Source§

impl<Cx: PatCx> Clone for WitnessPat<Cx>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Cx: PatCx> Debug for WitnessPat<Cx>

This is best effort and not good enough for a Display impl.

Source§

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

Formats the value using the given formatter. Read more