[][src]Enum rustc_middle::mir::ProjectionElem

pub enum ProjectionElem<V, T> {
    Deref,
    Field(Field, T),
    Index(V),
    ConstantIndex {
        offset: u64,
        min_length: u64,
        from_end: bool,
    },
    Subslice {
        from: u64,
        to: u64,
        from_end: bool,
    },
    Downcast(Option<Symbol>, VariantIdx),
}

Variants

Deref
Field(Field, T)
Index(V)
ConstantIndex

These indices are generated by slice patterns. Easiest to explain by example:

[X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
[_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
[_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
[_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },

Fields of ConstantIndex

offset: u64

index or -index (in Python terms), depending on from_end

min_length: u64

The thing being indexed must be at least this long. For arrays this is always the exact length.

from_end: bool

Counting backwards from end? This is always false when indexing an array.

Subslice

These indices are generated by slice patterns.

If from_end is true slice[from..slice.len() - to]. Otherwise array[from..to].

Fields of Subslice

from: u64to: u64from_end: bool

Whether to counts from the start or end of the array/slice. For PlaceElems this is true if and only if the base is a slice. For ProjectionKind, this can also be true for arrays.

Downcast(Option<Symbol>, VariantIdx)

"Downcast" to a variant of an ADT. Currently, we only introduce this for ADTs with more than one variant. It may be better to just introduce it always, or always for enums.

The included Symbol is the name of the variant, used for printing MIR.

Implementations

impl<V, T> ProjectionElem<V, T>[src]

fn is_indirect(&self) -> bool[src]

Returns true if the target of this projection may refer to a different region of memory than the base.

Trait Implementations

impl<V: Clone, T: Clone> Clone for ProjectionElem<V, T>[src]

impl<V: Copy, T: Copy> Copy for ProjectionElem<V, T>[src]

impl<V: Debug, T: Debug> Debug for ProjectionElem<V, T>[src]

impl<'tcx, V, T, __D: TyDecoder<'tcx>> Decodable<__D> for ProjectionElem<V, T> where
    T: Decodable<__D>,
    V: Decodable<__D>, 
[src]

impl<'tcx, V, T, __E: TyEncoder<'tcx>> Encodable<__E> for ProjectionElem<V, T> where
    T: Encodable<__E>,
    V: Encodable<__E>, 
[src]

impl<V: Eq, T: Eq> Eq for ProjectionElem<V, T>[src]

impl<V: Hash, T: Hash> Hash for ProjectionElem<V, T>[src]

impl<'__ctx, V, T> HashStable<StableHashingContext<'__ctx>> for ProjectionElem<V, T> where
    T: HashStable<StableHashingContext<'__ctx>>,
    V: HashStable<StableHashingContext<'__ctx>>, 
[src]

impl<V: Ord, T: Ord> Ord for ProjectionElem<V, T>[src]

impl<V: PartialEq, T: PartialEq> PartialEq<ProjectionElem<V, T>> for ProjectionElem<V, T>[src]

impl<V: PartialOrd, T: PartialOrd> PartialOrd<ProjectionElem<V, T>> for ProjectionElem<V, T>[src]

impl<V, T> StructuralEq for ProjectionElem<V, T>[src]

impl<V, T> StructuralPartialEq for ProjectionElem<V, T>[src]

Auto Trait Implementations

impl<V, T> RefUnwindSafe for ProjectionElem<V, T> where
    T: RefUnwindSafe,
    V: RefUnwindSafe
[src]

impl<V, T> Send for ProjectionElem<V, T> where
    T: Send,
    V: Send
[src]

impl<V, T> Sync for ProjectionElem<V, T> where
    T: Sync,
    V: Sync
[src]

impl<V, T> Unpin for ProjectionElem<V, T> where
    T: Unpin,
    V: Unpin
[src]

impl<V, T> UnwindSafe for ProjectionElem<V, T> where
    T: UnwindSafe,
    V: UnwindSafe
[src]

Blanket Implementations

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

impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
    T: Copy
[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> MaybeResult<T> for T[src]

type Error = !

impl<'tcx, T> Subst<'tcx> for T where
    T: TypeFoldable<'tcx>, 
[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.

impl<T> WithConstness for T[src]