Expand description
See docs in build/expr/mod.rs
Structs§
- Place
Builder 🔒 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 theto_place
method.
Enums§
- Place
Base 🔒 - The “outermost” place that holds this value.
Functions§
- 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/coroutine. This implies the vector returned from this function doesn’t contain
ProjectionElems
Downcast
,ConstantIndex
,Index
, orSubslice
because those will never be part of a path that is captured by a closure. We stop applying projections once we see the first projection that isn’t captured by a closure. - enable_
precise_ 🔒capture - Precise capture is enabled if user is using Rust Edition 2021 or higher.
- 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 thevar_hir_id
andprojection
. - is_
ancestor_ 🔒or_ same_ capture - Return true if the
proj_possible_ancestor
represents an ancestor path toproj_capture
orproj_possible_ancestor
is same asproj_capture
, assuming they both start off of the same root variable. - strip_
prefix 🔒 - Returns projections remaining after stripping an initial prefix of HIR projections.
- to_
upvars_ 🔒resolved_ place_ builder - Takes an upvar place and tries to resolve it into a
PlaceBuilder
withPlaceBase::Local