struct PatCtxt<'a, 'tcx> {
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    typeck_results: &'a TypeckResults<'tcx>,
    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§

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

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.

Converts inline const patterns.

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§

Looks up the type associated with this hir-id and applies the user-given substitutions; the hir-id must map to a suitable type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion 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: 56 bytes