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
Field(Field, T)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: u64Expand description
index or -index (in Python terms), depending on from_end
min_length: u64Expand description
The thing being indexed must be at least this long. For arrays this is always the exact length.
from_end: boolExpand description
Counting backwards from end? This is always false when indexing an array.
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
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]
impl<V, T> ProjectionElem<V, T>[src]fn is_indirect(&self) -> bool[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: Clone, T: Clone> Clone for ProjectionElem<V, T>[src]fn clone(&self) -> 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]
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]
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, __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<'tcx, V, T, __E: TyEncoder<'tcx>> Encodable<__E> for ProjectionElem<V, T> where
T: Encodable<__E>,
V: Encodable<__E>, [src]impl<V: Hash, T: Hash> Hash 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<'__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]
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
impl<V: Ord, T: Ord> Ord for ProjectionElem<V, T>[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: PartialEq, T: PartialEq> PartialEq<ProjectionElem<V, T>> for ProjectionElem<V, T>[src]fn eq(&self, other: &ProjectionElem<V, T>) -> bool[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]
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]
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]
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) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.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) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less 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,
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, T> Send for ProjectionElem<V, T> where
T: Send,
V: Send,
T: Send,
V: Send,
impl<V, T> Sync for ProjectionElem<V, T> where
T: Sync,
V: Sync,
T: Sync,
V: Sync,
impl<V, T> Unpin for ProjectionElem<V, T> where
T: Unpin,
V: Unpin,
T: Unpin,
V: Unpin,
impl<V, T> UnwindSafe for ProjectionElem<V, T> where
T: UnwindSafe,
V: UnwindSafe,
T: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
T: Copy, [src]
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]ⓘ[src]
&'a Arena<'tcx>,
impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘ
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> MaybeResult<T> for T[src]
impl<T> MaybeResult<T> for T[src]impl<'tcx, T> Subst<'tcx> for T where
T: TypeFoldable<'tcx>, [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]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
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]
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> WithConstness for T[src]
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]
T: ?Sized,