rustc_type_ir::solve::inspect

Type Alias CanonicalState

Source
pub type CanonicalState<I, T> = Canonical<I, State<I, T>>;

Aliased Type§

struct CanonicalState<I, T> {
    pub value: State<I, T>,
    pub max_universe: UniverseIndex,
    pub variables: <I as Interner>::CanonicalVars,
}

Fields§

§value: State<I, T>§max_universe: UniverseIndex§variables: <I as Interner>::CanonicalVars

Layout§

Note: Encountered an error during type layout; the type failed to be normalized.

Implementations

Source§

impl<I: Interner, V> Canonical<I, V>

Source

pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<I, W>

Allows you to map the value of a canonical while keeping the same set of bound variables.

WARNING: This function is very easy to mis-use, hence the name! In particular, the new value W must use all the same type/region variables in precisely the same order as the original! (The ordering is defined by the TypeFoldable implementation of the type in question.)

An example of a correct use of this:

let a: Canonical<I, T> = ...;
let b: Canonical<I, (T,)> = a.unchecked_map(|v| (v, ));

An example of an incorrect use of this:

let a: Canonical<I, T> = ...;
let ty: Ty<I> = ...;
let b: Canonical<I, (T, Ty<I>)> = a.unchecked_map(|v| (v, ty));

Trait Implementations

Source§

impl<I, V> Clone for Canonical<I, V>
where I: Interner, V: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
Source§

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

Performs copy-assignment from source. Read more
Source§

impl<I, V> Debug for Canonical<I, V>
where I: Interner, V: Debug,

Source§

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

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

impl<I: Interner, V, __D: TyDecoder<I = I>> Decodable<__D> for Canonical<I, V>
where V: Decodable<__D>, I::CanonicalVars: Decodable<__D>,

Source§

fn decode(__decoder: &mut __D) -> Self

Source§

impl<I: Interner, V: Display> Display for Canonical<I, V>

Source§

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

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

impl<I: Interner, V, __E: TyEncoder<I = I>> Encodable<__E> for Canonical<I, V>
where V: Encodable<__E>, I::CanonicalVars: Encodable<__E>,

Source§

fn encode(&self, __encoder: &mut __E)

Source§

impl<I, V> Hash for Canonical<I, V>
where I: Interner, V: Hash,

Source§

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

Feeds this value into the given Hasher. Read more
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: Interner, V, __CTX> HashStable<__CTX> for Canonical<I, V>
where V: HashStable<__CTX>, I::CanonicalVars: HashStable<__CTX>,

Source§

fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)

Source§

impl<I, V> PartialEq for Canonical<I, V>
where I: Interner, V: PartialEq,

Source§

fn eq(&self, __other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
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, V> TypeFoldable<I> for Canonical<I, V>

Source§

fn try_fold_with<__F: FallibleTypeFolder<I>>( self, __folder: &mut __F, ) -> Result<Self, __F::Error>

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: TypeFolder<I>>(self, folder: &mut F) -> Self

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, V> TypeVisitable<I> for Canonical<I, V>

Source§

fn visit_with<__V: TypeVisitor<I>>(&self, __visitor: &mut __V) -> __V::Result

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

impl<I, V> Copy for Canonical<I, V>
where I: Interner, V: Copy,

Source§

impl<I, V> Eq for Canonical<I, V>
where I: Interner, V: Eq,