[−][src]Struct rustc_mir_build::thir::pattern::PatCtxt
Fields
tcx: TyCtxt<'tcx>param_env: ParamEnv<'tcx>typeck_results: &'a TypeckResults<'tcx>errors: Vec<PatternError>include_lint_checks: boolImplementations
impl<'_, '_> PatCtxt<'_, '_>[src]
pub(in thir::pattern::check_match) fn report_inlining_errors(
&self,
pat_span: Span
)[src]
&self,
pat_span: Span
)
pub(in thir::pattern::check_match) fn span_e0158(
&self,
span: Span,
text: &str
)[src]
&self,
span: Span,
text: &str
)
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]
&self,
cv: &'tcx Const<'tcx>,
id: HirId,
span: Span,
mir_structural_match_violation: bool
) -> Pat<'tcx>
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]
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
typeck_results: &'a TypeckResults<'tcx>
) -> Self
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]
&mut self,
expr: &'tcx Expr<'tcx>
) -> (PatKind<'tcx>, Option<Ascription<'tcx>>)
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]
&mut self,
ty: Ty<'tcx>,
lo: &'tcx Const<'tcx>,
hi: &'tcx Const<'tcx>,
end: RangeEnd,
span: Span
) -> PatKind<'tcx>
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]
&self,
ty: Ty<'tcx>,
lo: Option<&PatKind<'tcx>>,
hi: Option<&PatKind<'tcx>>
) -> Option<(&'tcx Const<'tcx>, &'tcx Const<'tcx>)>
pub(in thir::pattern) fn lower_pattern_unadjusted(
&mut self,
pat: &'tcx Pat<'tcx>
) -> Pat<'tcx>[src]
&mut self,
pat: &'tcx Pat<'tcx>
) -> Pat<'tcx>
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]
&mut self,
pats: &'tcx [&'tcx Pat<'tcx>],
expected_len: usize,
gap_pos: Option<usize>
) -> Vec<FieldPat<'tcx>>
pub(in thir::pattern) fn lower_patterns(
&mut self,
pats: &'tcx [&'tcx Pat<'tcx>]
) -> Vec<Pat<'tcx>>[src]
&mut self,
pats: &'tcx [&'tcx Pat<'tcx>]
) -> Vec<Pat<'tcx>>
pub(in thir::pattern) fn lower_opt_pattern(
&mut self,
pat: &'tcx Option<&'tcx Pat<'tcx>>
) -> Option<Pat<'tcx>>[src]
&mut self,
pat: &'tcx Option<&'tcx Pat<'tcx>>
) -> Option<Pat<'tcx>>
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]
&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>
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]
&mut self,
res: Res,
hir_id: HirId,
span: Span,
ty: Ty<'tcx>,
subpatterns: Vec<FieldPat<'tcx>>
) -> PatKind<'tcx>
pub(in thir::pattern) fn lower_path(
&mut self,
qpath: &QPath<'_>,
id: HirId,
span: Span
) -> Pat<'tcx>[src]
&mut self,
qpath: &QPath<'_>,
id: HirId,
span: Span
) -> Pat<'tcx>
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]
&mut self,
expr: &'tcx Expr<'tcx>
) -> PatKind<'tcx>
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]
pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]
pub(crate) fn typeck_results(&self) -> &TypeckResults<'tcx>[src]
pub(crate) fn user_substs_applied_to_ty_of_hir_id(
&self,
hir_id: HirId
) -> Option<CanonicalUserType<'tcx>>[src]
&self,
hir_id: HirId
) -> Option<CanonicalUserType<'tcx>>
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,
'tcx: 'a,
impl<'a, 'tcx> !UnwindSafe for PatCtxt<'a, 'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,