Struct rustc_infer::infer::canonical::Canonical
source · pub struct Canonical<'tcx, V> {
pub max_universe: UniverseIndex,
pub variables: &'tcx List<CanonicalVarInfo<'tcx>>,
pub value: V,
}
Expand description
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
variables: &'tcx List<CanonicalVarInfo<'tcx>>
value: V
Trait Implementations
sourceimpl<'tcx, V> CanonicalExt<'tcx, V> for Canonical<'tcx, V>
impl<'tcx, V> CanonicalExt<'tcx, V> for Canonical<'tcx, V>
sourcefn substitute(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>
) -> Vwhere
V: TypeFoldable<'tcx>,
fn substitute(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>
) -> Vwhere
V: TypeFoldable<'tcx>,
Instantiate the wrapped value, replacing each canonical value
with the value given in
var_values
. Read moresourcefn substitute_projected<T>(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
projection_fn: impl FnOnce(&V) -> T
) -> Twhere
T: TypeFoldable<'tcx>,
fn substitute_projected<T>(
&self,
tcx: TyCtxt<'tcx>,
var_values: &CanonicalVarValues<'tcx>,
projection_fn: impl FnOnce(&V) -> T
) -> Twhere
T: TypeFoldable<'tcx>,
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. Read moreAuto 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
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<'tcx, T> IsSuggestable<'tcx> for Twhere
T: TypeVisitable<'tcx>,
impl<'tcx, T> IsSuggestable<'tcx> for Twhere
T: TypeVisitable<'tcx>,
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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.