[−][src]Struct rustc_trait_selection::infer::canonical::Canonical

pub struct Canonical<'tcx, V> {
    pub max_universe: UniverseIndex,
    pub variables: &'tcx List<CanonicalVarInfo>,
    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: &'tcx List<CanonicalVarInfo>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, V> Clone for Canonical<'tcx, V> where
    V: Clone, 
[src]

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

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

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

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

impl<'tcx, V> PartialEq<Canonical<'tcx, V>> for Canonical<'tcx, V> where
    V: PartialEq<V>, 
[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<T> From<T> for T[src]

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

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]