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

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.

Fields

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

Implementations

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:

This example is not tested
let a: Canonical<'_, T> = ...;
let b: Canonical<'_, (T,)> = a.unchecked_map(|v| (v, ));

An example of an incorrect use of this:

This example is not tested
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<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>>>>> 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>, 
[src]

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

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>>, 
[src]

impl<'tcx, T> Key for Canonical<'tcx, T>[src]

Canonical query goals correspond to abstract trait operations that are not tied to any crate in particular.

type CacheSelector = DefaultCacheSelector

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

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>, 
[src]

Auto Trait Implementations

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

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

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

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
[src]

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<Ctxt, T> DepNodeParams<Ctxt> for T where
    Ctxt: DepContext,
    T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

type Error = !

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]