pub(in build) struct PlaceBuilder<'tcx> {
base: PlaceBase,
projection: Vec<PlaceElem<'tcx>>,
}
Expand description
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 to_place
method.
This is used internally when building a place for an expression like a.b.c
. The fields b
and c
can be progressively pushed onto the place builder that is created when converting a
.
Fields§
§base: PlaceBase
§projection: Vec<PlaceElem<'tcx>>
Implementations§
source§impl<'tcx> PlaceBuilder<'tcx>
impl<'tcx> PlaceBuilder<'tcx>
pub(in build) fn to_place( &self, cx: &Builder<'_, 'tcx>, ) -> Place<'tcx>
sourcepub(in build) fn try_to_place(
&self,
cx: &Builder<'_, 'tcx>,
) -> Option<Place<'tcx>>
pub(in build) fn try_to_place( &self, cx: &Builder<'_, 'tcx>, ) -> Option<Place<'tcx>>
Creates a Place
or returns None
if an upvar cannot be resolved
sourcepub(in build) fn resolve_upvar(
&self,
cx: &Builder<'_, 'tcx>,
) -> Option<PlaceBuilder<'tcx>>
pub(in build) fn resolve_upvar( &self, cx: &Builder<'_, 'tcx>, ) -> Option<PlaceBuilder<'tcx>>
Attempts to resolve the PlaceBuilder
.
Returns None
if this is not an upvar.
Upvars resolve may fail for a PlaceBuilder
when attempting to
resolve a disjoint field whose root variable is not captured
(destructured assignments) or when attempting to resolve a root
variable (discriminant matching with only wildcard arm) that is
not captured. This can happen because the final mir that will be
generated doesn’t require a read for this place. Failures will only
happen inside closures.
pub(crate) fn base(&self) -> PlaceBase
pub(crate) fn projection(&self) -> &[PlaceElem<'tcx>]
pub(crate) fn field(self, f: FieldIdx, ty: Ty<'tcx>) -> Self
pub(crate) fn deref(self) -> Self
pub(crate) fn downcast( self, adt_def: AdtDef<'tcx>, variant_index: VariantIdx, ) -> Self
fn index(self, index: Local) -> Self
pub(crate) fn project(self, elem: PlaceElem<'tcx>) -> Self
sourcepub(crate) fn clone_project(&self, elem: PlaceElem<'tcx>) -> Self
pub(crate) fn clone_project(&self, elem: PlaceElem<'tcx>) -> Self
Same as .clone().project(..)
but more efficient
Trait Implementations§
source§impl<'tcx> Clone for PlaceBuilder<'tcx>
impl<'tcx> Clone for PlaceBuilder<'tcx>
source§fn clone(&self) -> PlaceBuilder<'tcx>
fn clone(&self) -> PlaceBuilder<'tcx>
source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'tcx> Debug for PlaceBuilder<'tcx>
impl<'tcx> Debug for PlaceBuilder<'tcx>
source§impl<'tcx> From<Local> for PlaceBuilder<'tcx>
impl<'tcx> From<Local> for PlaceBuilder<'tcx>
source§impl<'tcx> From<Place<'tcx>> for PlaceBuilder<'tcx>
impl<'tcx> From<Place<'tcx>> for PlaceBuilder<'tcx>
source§impl<'tcx> From<PlaceBase> for PlaceBuilder<'tcx>
impl<'tcx> From<PlaceBase> for PlaceBuilder<'tcx>
source§impl<'tcx> PartialEq for PlaceBuilder<'tcx>
impl<'tcx> PartialEq for PlaceBuilder<'tcx>
impl<'tcx> StructuralPartialEq for PlaceBuilder<'tcx>
Auto Trait Implementations§
impl<'tcx> DynSend for PlaceBuilder<'tcx>
impl<'tcx> DynSync for PlaceBuilder<'tcx>
impl<'tcx> Freeze for PlaceBuilder<'tcx>
impl<'tcx> !RefUnwindSafe for PlaceBuilder<'tcx>
impl<'tcx> Send for PlaceBuilder<'tcx>
impl<'tcx> Sync for PlaceBuilder<'tcx>
impl<'tcx> Unpin for PlaceBuilder<'tcx>
impl<'tcx> !UnwindSafe for PlaceBuilder<'tcx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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