struct MatchVisitor<'thir, 'p, 'tcx> {
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    thir: &'thir Thir<'tcx>,
    lint_level: HirId,
    let_source: LetSource,
    pattern_arena: &'p TypedArena<DeconstructedPat<'p, 'tcx>>,
    error: Result<(), ErrorGuaranteed>,
}

Fields§

§tcx: TyCtxt<'tcx>§param_env: ParamEnv<'tcx>§thir: &'thir Thir<'tcx>§lint_level: HirId§let_source: LetSource§pattern_arena: &'p TypedArena<DeconstructedPat<'p, 'tcx>>§error: Result<(), ErrorGuaranteed>

Tracks if we encountered an error while checking this body. That the first function to report it stores it here. Some functions return Result to allow callers to short-circuit on error, but callers don’t need to store it here again.

Implementations§

source§

impl<'thir, 'p, 'tcx> MatchVisitor<'thir, 'p, 'tcx>

source

fn with_let_source(&mut self, let_source: LetSource, f: impl FnOnce(&mut Self))

source

fn with_lint_level<T>( &mut self, new_lint_level: LintLevel, f: impl FnOnce(&mut Self) -> T ) -> T

source

fn visit_land( &mut self, ex: &Expr<'tcx>, accumulator: &mut Vec<Option<(Span, RefutableFlag)>> ) -> Result<(), ErrorGuaranteed>

Visit a nested chain of &&. Used for if-let chains. This must call visit_expr on the subexpressions we are not handling ourselves.

source

fn visit_land_rhs( &mut self, ex: &Expr<'tcx> ) -> Result<Option<(Span, RefutableFlag)>, ErrorGuaranteed>

Visit the right-hand-side of a &&. Used for if-let chains. Returns Some if the expression was ultimately a let ... = ..., and None if it was a normal boolean expression. This must call visit_expr on the subexpressions we are not handling ourselves.

source

fn lower_pattern( &mut self, cx: &MatchCheckCtxt<'p, 'tcx>, pat: &Pat<'tcx> ) -> Result<&'p DeconstructedPat<'p, 'tcx>, ErrorGuaranteed>

source

fn new_cx( &self, refutability: RefutableFlag, match_span: Option<Span>, scrut_span: Span ) -> MatchCheckCtxt<'p, 'tcx>

source

fn check_let(&mut self, pat: &Pat<'tcx>, scrutinee: Option<ExprId>, span: Span)

source

fn check_match( &mut self, scrut: ExprId, arms: &[ArmId], source: MatchSource, expr_span: Span )

source

fn check_let_chain( &mut self, chain_refutabilities: Vec<Option<(Span, RefutableFlag)>>, whole_chain_span: Span )

source

fn analyze_binding( &mut self, pat: &Pat<'tcx>, refutability: RefutableFlag ) -> Result<(MatchCheckCtxt<'p, 'tcx>, UsefulnessReport<'p, 'tcx>), ErrorGuaranteed>

source

fn is_let_irrefutable( &mut self, pat: &Pat<'tcx> ) -> Result<RefutableFlag, ErrorGuaranteed>

source

fn check_binding_is_irrefutable( &mut self, pat: &Pat<'tcx>, origin: &str, sp: Option<Span> )

Trait Implementations§

source§

impl<'thir, 'tcx> Visitor<'thir, 'tcx> for MatchVisitor<'thir, '_, 'tcx>

source§

fn thir(&self) -> &'thir Thir<'tcx>

source§

fn visit_arm(&mut self, arm: &Arm<'tcx>)

source§

fn visit_expr(&mut self, ex: &Expr<'tcx>)

source§

fn visit_stmt(&mut self, stmt: &Stmt<'tcx>)

source§

fn visit_block(&mut self, block: &Block)

source§

fn visit_pat(&mut self, pat: &Pat<'tcx>)

Auto Trait Implementations§

§

impl<'thir, 'p, 'tcx> !RefUnwindSafe for MatchVisitor<'thir, 'p, 'tcx>

§

impl<'thir, 'p, 'tcx> !Send for MatchVisitor<'thir, 'p, 'tcx>

§

impl<'thir, 'p, 'tcx> !Sync for MatchVisitor<'thir, 'p, 'tcx>

§

impl<'thir, 'p, 'tcx> Unpin for MatchVisitor<'thir, 'p, 'tcx>

§

impl<'thir, 'p, 'tcx> !UnwindSafe for MatchVisitor<'thir, 'p, 'tcx>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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