Trait CanonicalExt
pub trait CanonicalExt<'db, V> {
// Required methods
fn instantiate(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
) -> V
where V: TypeFoldable<DbInterner<'db>>;
fn instantiate_projected<T>(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
projection_fn: impl FnOnce(&V) -> T,
) -> T
where T: TypeFoldable<DbInterner<'db>>;
}
Required Methods§
fn instantiate(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
) -> Vwhere
V: TypeFoldable<DbInterner<'db>>,
fn instantiate_projected<T>(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
projection_fn: impl FnOnce(&V) -> T,
) -> Twhere
T: TypeFoldable<DbInterner<'db>>,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
§impl<'db, V> CanonicalExt<'db, V> for Canonical<DbInterner<'db>, V>
FIXME(-Znext-solver): This or public because it is shared with the
new trait solver implementation. We should deduplicate canonicalization.
impl<'db, V> CanonicalExt<'db, V> for Canonical<DbInterner<'db>, V>
FIXME(-Znext-solver): This or public because it is shared with the new trait solver implementation. We should deduplicate canonicalization.
§fn instantiate(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
) -> Vwhere
V: TypeFoldable<DbInterner<'db>>,
fn instantiate(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
) -> Vwhere
V: TypeFoldable<DbInterner<'db>>,
Instantiate the wrapped value, replacing each canonical value
with the value given in var_values
.
§fn instantiate_projected<T>(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
projection_fn: impl FnOnce(&V) -> T,
) -> Twhere
T: TypeFoldable<DbInterner<'db>>,
fn instantiate_projected<T>(
&self,
tcx: DbInterner<'db>,
var_values: &CanonicalVarValues<DbInterner<'db>>,
projection_fn: impl FnOnce(&V) -> T,
) -> Twhere
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.