Type Alias Canonical

Source
pub type Canonical<'db, T> = Canonical<DbInterner<'db>, T>;

Aliased Type§

pub struct Canonical<'db, T> {
    pub value: T,
    pub max_universe: UniverseIndex,
    pub variables: CanonicalVars<'db>,
}

Fields§

§value: T§max_universe: UniverseIndex§variables: CanonicalVars<'db>

Trait Implementations§

Source§

impl<'db, V> CanonicalExt<'db, V> for Canonical<'db, V>

FIXME(-Znext-solver): This or public because it is shared with the new trait solver implementation. We should deduplicate canonicalization.

Source§

fn instantiate( &self, tcx: DbInterner<'db>, var_values: &CanonicalVarValues<'db>, ) -> V
where V: TypeFoldable<DbInterner<'db>>,

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

Source§

fn instantiate_projected<T>( &self, tcx: DbInterner<'db>, var_values: &CanonicalVarValues<'db>, projection_fn: impl FnOnce(&V) -> T, ) -> T
where T: TypeFoldable<DbInterner<'db>>,

Allows one to apply a instantiation 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 instantiation var_values to this value V, replacing each of the canonical variables.