rustc_middle::ty::typeck_results

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

Source§

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

Source

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

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

Source

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

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

Source

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

Source

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.

Source

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.

Source

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.)

Source

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

Source

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

Source

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

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn shrink_to_fit(&mut self)

Source

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

Source

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.

Source

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

Source

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

Source

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

Trait Implementations

Source§

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

Source§

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

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

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

Source§

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

Formats the value using the given formatter. Read more
Source§

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

Source§

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

Source§

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

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

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

Source§

type Target = IndexSlice<I, T>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

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

Source§

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

Mutably dereferences the value.
Source§

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

Source§

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

Source§

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

Source§

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

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

fn extend_one(&mut self, item: T)

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

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
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Creates a value from an iterator. Read more
Source§

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

Source§

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

Source§

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

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
Source§

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

Source§

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

Source§

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
Source§

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

Source§

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

Source§

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