Struct rustc_middle::infer::canonical::Canonical[][src]

pub struct Canonical<'tcx, V> {
    pub max_universe: UniverseIndex,
    pub variables: CanonicalVarInfos<'tcx>,
    pub value: V,

A “canonicalized” type V is one where all free inference variables have been rewritten to “canonical vars”. These are numbered starting from 0 in order of first appearance.


max_universe: UniverseIndexvariables: CanonicalVarInfos<'tcx>value: V


impl<'tcx, R> Canonical<'tcx, QueryResponse<'tcx, R>>[src]

pub fn is_proven(&self) -> bool[src]

pub fn is_ambiguous(&self) -> bool[src]

impl<'tcx, V> Canonical<'tcx, V>[src]

pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<'tcx, W>[src]

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<'_, T> = ...;
let b: Canonical<'_, (T,)> = a.unchecked_map(|v| (v, ));

An example of an incorrect use of this:

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

impl<'tcx> Canonical<'tcx, UserType<'tcx>>[src]

pub fn is_identity(&self) -> bool[src]

Returns true if this represents a substitution of the form [?0, ?1, ?2], i.e., each thing is mapped to a canonical variable with the same index.

Trait Implementations

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, &'tcx TyS<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, ()>>> for Canonical<'tcx, QueryResponse<'tcx, ()>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Binder<'tcx, FnSig<'tcx>>>>> for Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>[src]

impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Vec<OutlivesBound<'tcx>, Global>>>> for Canonical<'tcx, QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>[src]

impl<'tcx, V: Clone> Clone for Canonical<'tcx, V>[src]

impl<'tcx, V: Copy> Copy for Canonical<'tcx, V>[src]

impl<'tcx, V: Debug> Debug for Canonical<'tcx, V>[src]

impl<'tcx, V, __D: TyDecoder<'tcx>> Decodable<__D> for Canonical<'tcx, V> where
    V: Decodable<__D>, 

impl<'tcx, V, __E: TyEncoder<'tcx>> Encodable<__E> for Canonical<'tcx, V> where
    V: Encodable<__E>, 

impl<'tcx, V: Eq> Eq for Canonical<'tcx, V>[src]

impl<'tcx, V: Hash> Hash for Canonical<'tcx, V>[src]

impl<'tcx, '__ctx, V> HashStable<StableHashingContext<'__ctx>> for Canonical<'tcx, V> where
    V: HashStable<StableHashingContext<'__ctx>>, 

impl<'tcx, '__lifted, V> Lift<'__lifted> for Canonical<'tcx, V> where
    V: Lift<'__lifted>, 

type Lifted = Canonical<'__lifted, V::Lifted>

impl<'tcx, V: PartialEq> PartialEq<Canonical<'tcx, V>> for Canonical<'tcx, V>[src]

impl<'tcx, V> StructuralEq for Canonical<'tcx, V>[src]

impl<'tcx, V> StructuralPartialEq for Canonical<'tcx, V>[src]

impl<'tcx, V> TypeFoldable<'tcx> for Canonical<'tcx, V> where
    V: TypeFoldable<'tcx>, 

Auto Trait Implementations

impl<'tcx, V> !RefUnwindSafe for Canonical<'tcx, V>

impl<'tcx, V> !Send for Canonical<'tcx, V>

impl<'tcx, V> !Sync for Canonical<'tcx, V>

impl<'tcx, V> Unpin for Canonical<'tcx, V> where
    V: Unpin

impl<'tcx, V> !UnwindSafe for Canonical<'tcx, V>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

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

impl<T, U> Into<U> for T where
    U: From<T>, 

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

type Error = !

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

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]