pub type Canonical<'tcx, V> = Canonical<TyCtxt<'tcx>, V>;
Aliased Type§
struct Canonical<'tcx, V> {
pub value: V,
pub max_universe: UniverseIndex,
pub variables: &'tcx RawList<(), CanonicalVarInfo<TyCtxt<'tcx>>>,
}
Fields§
§value: V
§max_universe: UniverseIndex
§variables: &'tcx RawList<(), CanonicalVarInfo<TyCtxt<'tcx>>>
Trait Implementations§
source§impl<'tcx, V> CanonicalExt<'tcx, V> for Canonical<'tcx, V>
impl<'tcx, V> CanonicalExt<'tcx, V> for Canonical<'tcx, V>
source§fn instantiate(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
) -> Vwhere
V: TypeFoldable<TyCtxt<'tcx>>,
fn instantiate(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
) -> Vwhere
V: TypeFoldable<TyCtxt<'tcx>>,
Instantiate the wrapped value, replacing each canonical value
with the value given in var_values
.
source§fn instantiate_projected<T>(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
projection_fn: impl FnOnce(&V) -> T,
) -> Twhere
T: TypeFoldable<TyCtxt<'tcx>>,
fn instantiate_projected<T>(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
projection_fn: impl FnOnce(&V) -> T,
) -> Twhere
T: TypeFoldable<TyCtxt<'tcx>>,
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.
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.