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

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
Expand description

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 },
Show fields

Fields of ConstantIndex

offset: u64
Expand description

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

min_length: u64
Expand description

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

from_end: bool
Expand description

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

Subslice
Expand description

These indices are generated by slice patterns.

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

Show fields

Fields of Subslice

from: u64to: u64from_end: bool
Expand description

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)
Expand description

“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]

fn clone(&self) -> ProjectionElem<V, T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

fn decode(__decoder: &mut __D) -> Result<Self, <__D as Decoder>::Error>[src]

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

fn encode(&self, __encoder: &mut __E) -> Result<(), <__E as Encoder>::Error>[src]

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

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher, 
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

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

fn hash_stable(
    &self,
    __hcx: &mut StableHashingContext<'__ctx>,
    __hasher: &mut StableHasher
)
[src]

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

fn cmp(&self, other: &ProjectionElem<V, T>) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

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

fn eq(&self, other: &ProjectionElem<V, T>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ProjectionElem<V, T>) -> bool[src]

This method tests for !=.

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

fn partial_cmp(&self, other: &ProjectionElem<V, T>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

impl<V: Eq, T: Eq> Eq 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, 

impl<V, T> Send for ProjectionElem<V, T> where
    T: Send,
    V: Send, 

impl<V, T> Sync for ProjectionElem<V, T> where
    T: Sync,
    V: Sync, 

impl<V, T> Unpin for ProjectionElem<V, T> where
    T: Unpin,
    V: Unpin, 

impl<V, T> UnwindSafe for ProjectionElem<V, T> where
    T: UnwindSafe,
    V: UnwindSafe, 

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn allocate_on(Self, &'a Arena<'tcx>) -> &'a mut T[src]

pub fn allocate_from_iter(
    &'a Arena<'tcx>,
    impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]

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

pub fn subst_spanned(Self, TyCtxt<'tcx>, &[GenericArg<'tcx>], Option<Span>) -> T[src]

fn subst(self, tcx: TyCtxt<'tcx>, substs: &[GenericArg<'tcx>]) -> Self[src]

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

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