Struct rustc_mir_build::build::expr::as_place::PlaceBuilder[−][src]

pub(crate) struct PlaceBuilder<'tcx> {
    base: PlaceBase,
    projection: Vec<PlaceElem<'tcx>>,
}

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: PlaceBaseprojection: Vec<PlaceElem<'tcx>>

Implementations

impl<'tcx> PlaceBuilder<'tcx>[src]

pub(crate) fn into_place<'a>(
    self,
    tcx: TyCtxt<'tcx>,
    typeck_results: &'a TypeckResults<'tcx>
) -> Place<'tcx>
[src]

fn expect_upvars_resolved<'a>(
    self,
    tcx: TyCtxt<'tcx>,
    typeck_results: &'a TypeckResults<'tcx>
) -> PlaceBuilder<'tcx>
[src]

pub(crate) fn try_upvars_resolved<'a>(
    self,
    tcx: TyCtxt<'tcx>,
    typeck_results: &'a TypeckResults<'tcx>
) -> Result<PlaceBuilder<'tcx>, PlaceBuilder<'tcx>>
[src]

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[src]

pub(crate) fn field(self, f: Field, ty: Ty<'tcx>) -> Self[src]

pub(crate) fn deref(self) -> Self[src]

pub(crate) fn downcast(
    self,
    adt_def: &'tcx AdtDef,
    variant_index: VariantIdx
) -> Self
[src]

fn index(self, index: Local) -> Self[src]

pub(crate) fn project(self, elem: PlaceElem<'tcx>) -> Self[src]

Trait Implementations

impl<'tcx> Clone for PlaceBuilder<'tcx>[src]

impl<'tcx> Debug for PlaceBuilder<'tcx>[src]

impl<'tcx> From<Local> for PlaceBuilder<'tcx>[src]

impl<'tcx> From<PlaceBase> for PlaceBuilder<'tcx>[src]

impl<'tcx> PartialEq<PlaceBuilder<'tcx>> for PlaceBuilder<'tcx>[src]

impl<'tcx> StructuralPartialEq for PlaceBuilder<'tcx>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.