Struct rustc_mir_build::build::expr::as_place::PlaceBuilder
source · [−]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 into_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
sourceimpl<'tcx> PlaceBuilder<'tcx>
impl<'tcx> PlaceBuilder<'tcx>
pub(in build) fn into_place<'a>(
self,
tcx: TyCtxt<'tcx>,
upvars: &'a SortedIndexMultiMap<usize, HirId, Capture<'tcx>>
) -> Place<'tcx>
fn expect_upvars_resolved<'a>(
self,
tcx: TyCtxt<'tcx>,
upvars: &'a SortedIndexMultiMap<usize, HirId, Capture<'tcx>>
) -> PlaceBuilder<'tcx>
sourcepub(in build) fn try_upvars_resolved<'a>(
self,
tcx: TyCtxt<'tcx>,
upvars: &'a SortedIndexMultiMap<usize, HirId, Capture<'tcx>>
) -> Result<PlaceBuilder<'tcx>, PlaceBuilder<'tcx>>
pub(in build) fn try_upvars_resolved<'a>(
self,
tcx: TyCtxt<'tcx>,
upvars: &'a SortedIndexMultiMap<usize, HirId, Capture<'tcx>>
) -> Result<PlaceBuilder<'tcx>, PlaceBuilder<'tcx>>
Attempts to resolve the PlaceBuilder
.
On success, it will return the resolved PlaceBuilder
.
On failure, it will return itself.
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 field(self, f: Field, 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
Trait Implementations
sourceimpl<'tcx> Clone for PlaceBuilder<'tcx>
impl<'tcx> Clone for PlaceBuilder<'tcx>
sourcefn clone(&self) -> PlaceBuilder<'tcx>
fn clone(&self) -> PlaceBuilder<'tcx>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'tcx> Debug for PlaceBuilder<'tcx>
impl<'tcx> Debug for PlaceBuilder<'tcx>
sourceimpl<'tcx> From<Local> for PlaceBuilder<'tcx>
impl<'tcx> From<Local> for PlaceBuilder<'tcx>
sourceimpl<'tcx> From<Place<'tcx>> for PlaceBuilder<'tcx>
impl<'tcx> From<Place<'tcx>> for PlaceBuilder<'tcx>
sourceimpl<'tcx> From<PlaceBase> for PlaceBuilder<'tcx>
impl<'tcx> From<PlaceBase> for PlaceBuilder<'tcx>
sourceimpl<'tcx> PartialEq<PlaceBuilder<'tcx>> for PlaceBuilder<'tcx>
impl<'tcx> PartialEq<PlaceBuilder<'tcx>> for PlaceBuilder<'tcx>
sourcefn eq(&self, other: &PlaceBuilder<'tcx>) -> bool
fn eq(&self, other: &PlaceBuilder<'tcx>) -> bool
impl<'tcx> StructuralPartialEq for PlaceBuilder<'tcx>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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