PlaceRef in rustc_middle::mir::statement - Rust (original) (raw)
pub struct PlaceRef<'tcx> {
pub local: Local,
pub projection: &'tcx [PlaceElem<'tcx>],
}
Finds the innermost Local
from this Place
, if it is either a local itself or a single deref of a local.
Returns true
if this Place
contains a Deref
projection.
If Place::is_indirect
returns false, the caller knows that the Place
refers to the same region of memory as its base.
Returns true
if this Place
’s first projection is Deref
.
This is useful because for MIR phases AnalysisPhase::PostCleanup
and later,Deref
projections can only occur as the first projection. In that case this method is equivalent to is_indirect
, but faster.
If this place represents a local variable like _X
with no projections, return Some(_X)
.
Iterate over the projections in evaluation order, i.e., the first element is the base with its projection and then subsequently more projections are added. As a concrete example, given the place a.b.c, this would yield:
- (a, .b)
- (a.b, .c)
Given a place without projections, the iterator is empty.
Generates a new place by appending more_projections
to the existing ones and interning the result.
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: 24 bytes