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

pub struct Canonical<'tcx, V> {
    pub max_universe: UniverseIndex,
    pub variables: CanonicalVarInfos<'tcx>,
    pub value: V,
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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: UniverseIndex
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

variables: CanonicalVarInfos<'tcx>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

value: V
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Methods

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

pub fn substitute(
    &self,
    tcx: TyCtxt<'tcx>,
    var_values: &CanonicalVarValues<'tcx>
) -> V where
    V: TypeFoldable<'tcx>, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Instantiate the wrapped value, replacing each canonical value with the value given in var_values.

pub fn substitute_projected<T>(
    &self,
    tcx: TyCtxt<'tcx>,
    var_values: &CanonicalVarValues<'tcx>,
    projection_fn: impl FnOnce(&V) -> &T
) -> T where
    T: TypeFoldable<'tcx>, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Allows one to apply a substitute to some subset of self.value. Invoke projection_fn with self.value to get a value V that is expressed in terms of the same canonical variables bound in self (usually this extracts from subset of self). Apply the substitution var_values to this value V, replacing each of the canonical variables.

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

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

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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

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

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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 for Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>[src]

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

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

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

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

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

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

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

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

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

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

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

impl<'tcx> ArenaField<'tcx> for Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>[src]

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

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

impl<'tcx> ArenaField<'tcx> for Canonical<'tcx, QueryResponse<'tcx, Ty<'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: Decodable> Decodable for Canonical<'tcx, V>[src]

impl<'tcx, V: Encodable> Encodable for Canonical<'tcx, V>[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.

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

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

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

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<T> ArenaAllocatable 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<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T[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 = !

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<E> SpecializationError for E[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]