[−][src]Struct rustc_mir_build::thir::pattern::PatCtxt

pub(crate) struct PatCtxt<'a, 'tcx> {
    pub(crate) tcx: TyCtxt<'tcx>,
    pub(crate) param_env: ParamEnv<'tcx>,
    pub(crate) typeck_results: &'a TypeckResults<'tcx>,
    pub(crate) errors: Vec<PatternError>,
    include_lint_checks: bool,
}

Fields

tcx: TyCtxt<'tcx>param_env: ParamEnv<'tcx>typeck_results: &'a TypeckResults<'tcx>errors: Vec<PatternError>include_lint_checks: bool

Implementations

impl<'_, '_> PatCtxt<'_, '_>[src]

pub(in thir::pattern::check_match) fn report_inlining_errors(
    &self,
    pat_span: Span
)
[src]

pub(in thir::pattern::check_match) fn span_e0158(
    &self,
    span: Span,
    text: &str
)
[src]

impl<'a, 'tcx> PatCtxt<'a, 'tcx>[src]

pub(in thir::pattern) fn const_to_pat(
    &self,
    cv: &'tcx Const<'tcx>,
    id: HirId,
    span: Span,
    mir_structural_match_violation: bool
) -> Pat<'tcx>
[src]

Converts an evaluated constant to a pattern (if possible). This means aggregate values (like structs and enums) are converted to a pattern that matches the value (as if you'd compared via structural equality).

impl<'a, 'tcx> PatCtxt<'a, 'tcx>[src]

pub(crate) fn new(
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    typeck_results: &'a TypeckResults<'tcx>
) -> Self
[src]

pub(crate) fn include_lint_checks(&mut self) -> &mut Self[src]

pub(crate) fn lower_pattern(&mut self, pat: &'tcx Pat<'tcx>) -> Pat<'tcx>[src]

pub(in thir::pattern) fn lower_range_expr(
    &mut self,
    expr: &'tcx Expr<'tcx>
) -> (PatKind<'tcx>, Option<Ascription<'tcx>>)
[src]

pub(in thir::pattern) fn lower_pattern_range(
    &mut self,
    ty: Ty<'tcx>,
    lo: &'tcx Const<'tcx>,
    hi: &'tcx Const<'tcx>,
    end: RangeEnd,
    span: Span
) -> PatKind<'tcx>
[src]

pub(in thir::pattern) fn normalize_range_pattern_ends(
    &self,
    ty: Ty<'tcx>,
    lo: Option<&PatKind<'tcx>>,
    hi: Option<&PatKind<'tcx>>
) -> Option<(&'tcx Const<'tcx>, &'tcx Const<'tcx>)>
[src]

pub(in thir::pattern) fn lower_pattern_unadjusted(
    &mut self,
    pat: &'tcx Pat<'tcx>
) -> Pat<'tcx>
[src]

pub(in thir::pattern) fn lower_tuple_subpats(
    &mut self,
    pats: &'tcx [&'tcx Pat<'tcx>],
    expected_len: usize,
    gap_pos: Option<usize>
) -> Vec<FieldPat<'tcx>>
[src]

pub(in thir::pattern) fn lower_patterns(
    &mut self,
    pats: &'tcx [&'tcx Pat<'tcx>]
) -> Vec<Pat<'tcx>>
[src]

pub(in thir::pattern) fn lower_opt_pattern(
    &mut self,
    pat: &'tcx Option<&'tcx Pat<'tcx>>
) -> Option<Pat<'tcx>>
[src]

pub(in thir::pattern) fn slice_or_array_pattern(
    &mut self,
    span: Span,
    ty: Ty<'tcx>,
    prefix: &'tcx [&'tcx Pat<'tcx>],
    slice: &'tcx Option<&'tcx Pat<'tcx>>,
    suffix: &'tcx [&'tcx Pat<'tcx>]
) -> PatKind<'tcx>
[src]

pub(in thir::pattern) fn lower_variant_or_leaf(
    &mut self,
    res: Res,
    hir_id: HirId,
    span: Span,
    ty: Ty<'tcx>,
    subpatterns: Vec<FieldPat<'tcx>>
) -> PatKind<'tcx>
[src]

pub(in thir::pattern) fn lower_path(
    &mut self,
    qpath: &QPath<'_>,
    id: HirId,
    span: Span
) -> Pat<'tcx>
[src]

Takes a HIR Path. If the path is a constant, evaluates it and feeds it to const_to_pat. Any other path (like enum variants without fields) is converted to the corresponding pattern via lower_variant_or_leaf.

pub(in thir::pattern) fn lower_lit(
    &mut self,
    expr: &'tcx Expr<'tcx>
) -> PatKind<'tcx>
[src]

Converts literals, paths and negation of literals to patterns. The special case for negation exists to allow things like -128_i8 which would overflow if we tried to evaluate 128_i8 and then negate afterwards.

Trait Implementations

impl<'tcx, '_> UserAnnotatedTyHelpers<'tcx> for PatCtxt<'_, 'tcx>[src]

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for PatCtxt<'a, 'tcx>

impl<'a, 'tcx> !Send for PatCtxt<'a, 'tcx>

impl<'a, 'tcx> !Sync for PatCtxt<'a, 'tcx>

impl<'a, 'tcx> Unpin for PatCtxt<'a, 'tcx> where
    'tcx: 'a, 

impl<'a, 'tcx> !UnwindSafe for PatCtxt<'a, 'tcx>

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, 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.