Module rustc_mir_build::build::expr::as_place[−][src]

See docs in build/expr/mod.rs

Structs

PlaceBuilder

PlaceBuilder is used to create places during MIR construction. It allows you to “build up” a place by pushing more and more projections onto the end, and then convert the final set into a place using the into_place method.

Enums

PlaceBase

The “outermost” place that holds this value.

Functions

compute_capture_idx

Computes the index of a capture within the desugared closure provided the closure’s closure_min_captures and the capture’s index of the capture in the ty::MinCaptureList of the root variable var_hir_id.

convert_to_hir_projections_and_truncate_for_capture

Given a list of MIR projections, convert them to list of HIR ProjectionKind. The projections are truncated to represent a path that might be captured by a closure/generator. This implies the vector returned from this function doesn’t contain ProjectionElems Downcast, ConstantIndex, Index, or Subslice because those will never be part of a path that is captued by a closure. We stop applying projections once we see the first projection that isn’t captured by a closure.

find_capture_matching_projections

Given a closure, returns the index of a capture within the desugared closure struct and the ty::CapturedPlace which is the ancestor of the Place represented using the var_hir_id and projection.

is_ancestor_or_same_capture

Return true if the proj_possible_ancestor represents an ancestor path to proj_capture or proj_possible_ancestor is same as proj_capture, assuming they both start off of the same root variable.

to_upvars_resolved_place_builder

Takes a PlaceBuilder and resolves the upvar (if any) within it, so that the PlaceBuilder now starts from PlaceBase::Local.