rustc_middle::ty

Type Alias CanonicalUserTypeAnnotations

Source
pub type CanonicalUserTypeAnnotations<'tcx> = IndexVec<UserTypeAnnotationIndex, CanonicalUserTypeAnnotation<'tcx>>;
Expand description

Mapping of type annotation indices to canonical user type annotations.

Aliased Type§

struct CanonicalUserTypeAnnotations<'tcx> {
    pub raw: Vec<CanonicalUserTypeAnnotation<'tcx>>,
    /* private fields */
}

Fields§

§raw: Vec<CanonicalUserTypeAnnotation<'tcx>>

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes

Implementations

§

impl<I, T> IndexVec<I, T>
where I: Idx,

pub const fn new() -> IndexVec<I, T>

Constructs a new, empty IndexVec<I, T>.

pub const fn from_raw(raw: Vec<T>) -> IndexVec<I, T>

Constructs a new IndexVec<I, T> from a Vec<T>.

pub fn with_capacity(capacity: usize) -> IndexVec<I, T>

pub fn from_elem<S>(elem: T, universe: &IndexSlice<I, S>) -> IndexVec<I, T>
where T: Clone,

Creates a new vector with a copy of elem for each index in universe.

Thus IndexVec::from_elem(elem, &universe) is equivalent to IndexVec::<I, _>::from_elem_n(elem, universe.len()). That can help type inference as it ensures that the resulting vector uses the same index type as universe, rather than something potentially surprising.

For example, if you want to store data for each local in a MIR body, using let mut uses = IndexVec::from_elem(vec![], &body.local_decls); ensures that uses is an IndexVec<Local, _>, and thus can give better error messages later if one accidentally mismatches indices.

pub fn from_elem_n(elem: T, n: usize) -> IndexVec<I, T>
where T: Clone,

Creates a new IndexVec with n copies of the elem.

pub fn from_fn_n(func: impl FnMut(I) -> T, n: usize) -> IndexVec<I, T>

Create an IndexVec with n elements, where the value of each element is the result of func(i). (The underlying vector will be allocated only once, with a capacity of at least n.)

pub fn as_slice(&self) -> &IndexSlice<I, T>

pub fn as_mut_slice(&mut self) -> &mut IndexSlice<I, T>

pub fn push(&mut self, d: T) -> I

Pushes an element to the array returning the index where it was pushed to.

pub fn pop(&mut self) -> Option<T>

pub fn into_iter(self) -> IntoIter<T>

pub fn into_iter_enumerated( self, ) -> impl DoubleEndedIterator + ExactSizeIterator

pub fn drain<R>(&mut self, range: R) -> impl Iterator<Item = T>
where R: RangeBounds<usize>,

pub fn drain_enumerated<R>(&mut self, range: R) -> impl Iterator<Item = (I, T)>
where R: RangeBounds<usize>,

pub fn shrink_to_fit(&mut self)

pub fn truncate(&mut self, a: usize)

pub fn ensure_contains_elem( &mut self, elem: I, fill_value: impl FnMut() -> T, ) -> &mut T

Grows the index vector so that it contains an entry for elem; if that is already true, then has no effect. Otherwise, inserts new values as needed by invoking fill_value.

Returns a reference to the elem entry.

pub fn resize(&mut self, new_len: usize, value: T)
where T: Clone,

pub fn resize_to_elem(&mut self, elem: I, fill_value: impl FnMut() -> T)

pub fn append(&mut self, other: &mut IndexVec<I, T>)

Trait Implementations

§

impl<I, T> Borrow<IndexSlice<I, T>> for IndexVec<I, T>
where I: Idx,

§

fn borrow(&self) -> &IndexSlice<I, T>

Immutably borrows from an owned value. Read more
§

impl<I, T> BorrowMut<IndexSlice<I, T>> for IndexVec<I, T>
where I: Idx,

§

fn borrow_mut(&mut self) -> &mut IndexSlice<I, T>

Mutably borrows from an owned value. Read more
§

impl<I, T> Clone for IndexVec<I, T>
where I: Clone + Idx, T: Clone,

§

fn clone(&self) -> IndexVec<I, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<I, T> Debug for IndexVec<I, T>
where I: Idx, T: Debug,

§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<D, I, T> Decodable<D> for IndexVec<I, T>
where D: Decoder, I: Idx, T: Decodable<D>,

§

fn decode(d: &mut D) -> IndexVec<I, T>

§

impl<I, T> Default for IndexVec<I, T>
where I: Idx,

§

fn default() -> IndexVec<I, T>

Returns the “default value” for a type. Read more
§

impl<I, T> Deref for IndexVec<I, T>
where I: Idx,

§

type Target = IndexSlice<I, T>

The resulting type after dereferencing.
§

fn deref(&self) -> &IndexSlice<I, T>

Dereferences the value.
§

impl<I, T> DerefMut for IndexVec<I, T>
where I: Idx,

§

fn deref_mut(&mut self) -> &mut IndexSlice<I, T>

Mutably dereferences the value.
§

impl<S, I, T> Encodable<S> for IndexVec<I, T>
where S: Encoder, I: Idx, T: Encodable<S>,

§

fn encode(&self, s: &mut S)

§

impl<I, T> Extend<T> for IndexVec<I, T>
where I: Idx,

§

fn extend<J>(&mut self, iter: J)
where J: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
§

impl<I, T, const N: usize> From<[T; N]> for IndexVec<I, T>
where I: Idx,

§

fn from(array: [T; N]) -> IndexVec<I, T>

Converts to this type from the input type.
§

impl<I, T> FromIterator<T> for IndexVec<I, T>
where I: Idx,

§

fn from_iter<J>(iter: J) -> IndexVec<I, T>
where J: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
§

impl<I, T> Hash for IndexVec<I, T>
where I: Hash + Idx, T: Hash,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

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

impl<I, T, CTX> HashStable<CTX> for IndexVec<I, T>
where I: Idx, T: HashStable<CTX>,

Source§

fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)

§

impl<I, T> IntoIterator for IndexVec<I, T>
where I: Idx,

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> IntoIter<T>

Creates an iterator from a value. Read more
Source§

impl<I: Idx + 'static, T: ParameterizedOverTcx> ParameterizedOverTcx for IndexVec<I, T>

Source§

type Value<'tcx> = IndexVec<I, <T as ParameterizedOverTcx>::Value<'tcx>>

§

impl<I, T> PartialEq for IndexVec<I, T>
where I: PartialEq + Idx, T: PartialEq,

§

fn eq(&self, other: &IndexVec<I, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I, T, Ix> TypeFoldable<I> for IndexVec<Ix, T>
where I: Interner, T: TypeFoldable<I>, Ix: Idx,

Source§

fn try_fold_with<F>( self, folder: &mut F, ) -> Result<IndexVec<Ix, T>, <F as FallibleTypeFolder<I>>::Error>
where F: FallibleTypeFolder<I>,

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
Source§

fn fold_with<F>(self, folder: &mut F) -> Self
where F: TypeFolder<I>,

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
Source§

impl<I, T, Ix> TypeVisitable<I> for IndexVec<Ix, T>
where I: Interner, T: TypeVisitable<I>, Ix: Idx,

Source§

fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Result
where V: TypeVisitor<I>,

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
§

impl<I, T> Eq for IndexVec<I, T>
where I: Eq + Idx, T: Eq,

§

impl<I, T> Send for IndexVec<I, T>
where I: Idx, T: Send,

§

impl<I, T> StructuralPartialEq for IndexVec<I, T>
where I: Idx,