Struct rustc_middle::mir::tcx::PlaceTy[][src]

pub struct PlaceTy<'tcx> {
    pub ty: Ty<'tcx>,
    pub variant_index: Option<VariantIdx>,


ty: Ty<'tcx>variant_index: Option<VariantIdx>

Downcast to a particular variant of an enum, if included.


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

pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx>[src]

pub fn field_ty(self, tcx: TyCtxt<'tcx>, f: &Field) -> Ty<'tcx>[src]

place_ty.field_ty(tcx, f) computes the type at a given field of a record or enum-variant. (Most clients of PlaceTy can instead just extract the relevant type directly from their PlaceElem, but some instances of ProjectionElem<V, T> do not carry a Ty for T.)

Note that the resulting type has not been normalized.

pub fn projection_ty(
    tcx: TyCtxt<'tcx>,
    elem: PlaceElem<'tcx>
) -> PlaceTy<'tcx>

Convenience wrapper around projection_ty_core for PlaceElem, where we can just use the Ty that is already stored inline on field projection elems.

pub fn projection_ty_core<V, T>(
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    elem: &ProjectionElem<V, T>,
    handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>
) -> PlaceTy<'tcx> where
    V: Debug,
    T: Debug

place_ty.projection_ty_core(tcx, elem, |...| { ... }) projects place_ty onto elem, returning the appropriate Ty or downcast variant corresponding to that projection. The handle_field callback must map a Field to its Ty, (which should be trivial when T = Ty).

Trait Implementations

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

impl<'tcx> Copy for PlaceTy<'tcx>[src]

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

impl<'tcx> TypeFoldable<'tcx> for PlaceTy<'tcx>[src]

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for PlaceTy<'tcx>

impl<'tcx> !Send for PlaceTy<'tcx>

impl<'tcx> !Sync for PlaceTy<'tcx>

impl<'tcx> Unpin for PlaceTy<'tcx>

impl<'tcx> !UnwindSafe for PlaceTy<'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
    T: Copy

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

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

impl<T, U> Into<U> for T where
    U: From<T>, 

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

type Error = !

impl<'tcx, T> Subst<'tcx> for T where
    T: TypeFoldable<'tcx>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]