Struct rustc_typeck::mem_categorization::MemCategorizationContext[][src]

pub(crate) struct MemCategorizationContext<'a, 'tcx> {
    pub(crate) typeck_results: &'a TypeckResults<'tcx>,
    infcx: &'a InferCtxt<'a, 'tcx>,
    param_env: ParamEnv<'tcx>,
    body_owner: LocalDefId,
    upvars: Option<&'tcx FxIndexMap<HirId, Upvar>>,
}

Fields

typeck_results: &'a TypeckResults<'tcx>infcx: &'a InferCtxt<'a, 'tcx>param_env: ParamEnv<'tcx>body_owner: LocalDefIdupvars: Option<&'tcx FxIndexMap<HirId, Upvar>>

Implementations

Creates a MemCategorizationContext.

Returns the type of value that this pattern matches against. Some non-obvious cases:

  • a ref x binding matches against a value of type T and gives x the type &T; we return T.
  • a pattern with implicit derefs (thanks to default binding modes #42640) may look like Some(x) but in fact have implicit deref patterns attached (e.g., it is really &Some(x)). In that case, we return the “outermost” type (e.g., `&Option).

Like pat_ty, but ignores implicit & patterns.

Categorize an upvar.

Note: the actual upvar access contains invisible derefs of closure environment and upvar reference as appropriate. Only regionck cares about these dereferences, so we let it compute them as needed.

Returns the variant index for an ADT used within a Struct or TupleStruct pattern Here pat_hir_id is the HirId of the pattern itself.

Returns the total number of fields in an ADT variant used within a pattern. Here pat_hir_id is the HirId of the pattern itself.

Returns the total number of fields in a tuple used within a Tuple pattern. Here pat_hir_id is the HirId of the pattern itself.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. 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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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