pub type Canonical<T> = Canonical<T>;
Aliased Type§
struct Canonical<T> {
pub value: T,
pub binders: CanonicalVarKinds<<T as HasInterner>::Interner>,
}
Fields§
§value: T
The item that is canonicalized.
binders: CanonicalVarKinds<<T as HasInterner>::Interner>
The kind/universe of the variable.
Implementations
Trait Implementations
§impl<T, I> CanonicalExt<T, I> for Canonical<T>where
T: HasInterner<Interner = I>,
I: Interner,
impl<T, I> CanonicalExt<T, I> for Canonical<T>where
T: HasInterner<Interner = I>,
I: Interner,
§fn map<OP, U>(self, interner: I, op: OP) -> Canonical<U>where
OP: FnOnce(T) -> U,
T: TypeFoldable<I>,
U: TypeFoldable<I> + HasInterner<Interner = I>,
fn map<OP, U>(self, interner: I, op: OP) -> Canonical<U>where
OP: FnOnce(T) -> U,
T: TypeFoldable<I>,
U: TypeFoldable<I> + HasInterner<Interner = I>,
Maps the contents using op
, but preserving the binders.
NB. op
will be invoked with an instantiated version of the
canonical value, where inference variables (from a fresh
inference context) are used in place of the quantified free
variables. The result should be in terms of those same
inference variables and will be re-canonicalized.
§impl<T, U> CastTo<Canonical<U>> for Canonical<T>where
T: CastTo<U> + HasInterner,
U: HasInterner<Interner = <T as HasInterner>::Interner>,
impl<T, U> CastTo<Canonical<U>> for Canonical<T>where
T: CastTo<U> + HasInterner,
U: HasInterner<Interner = <T as HasInterner>::Interner>,
§impl<T> HasInterner for Canonical<T>where
T: HasInterner,
impl<T> HasInterner for Canonical<T>where
T: HasInterner,
§impl<I, T> TypeFoldable<I> for Canonical<T>where
I: Interner,
T: HasInterner<Interner = I> + TypeFoldable<I>,
impl<I, T> TypeFoldable<I> for Canonical<T>where
I: Interner,
T: HasInterner<Interner = I> + TypeFoldable<I>,
§fn try_fold_with<E>(
self,
folder: &mut dyn FallibleTypeFolder<I, Error = E>,
outer_binder: DebruijnIndex,
) -> Result<Canonical<T>, E>
fn try_fold_with<E>( self, folder: &mut dyn FallibleTypeFolder<I, Error = E>, outer_binder: DebruijnIndex, ) -> Result<Canonical<T>, E>
Apply the given folder
folder
to self
; binders
is the
number of binders that are in scope when beginning the
folder. Typically binders
starts as 0, but is adjusted when
we encounter Binders<T>
in the IR or other similar
constructs.§fn fold_with(
self,
folder: &mut dyn TypeFolder<I, Error = Infallible>,
outer_binder: DebruijnIndex,
) -> Self
fn fold_with( self, folder: &mut dyn TypeFolder<I, Error = Infallible>, outer_binder: DebruijnIndex, ) -> Self
A convenient alternative to
try_fold_with
for use with infallible
folders. Do not override this method, to ensure coherence with
try_fold_with
.§impl<I, T> TypeVisitable<I> for Canonical<T>where
I: Interner,
T: HasInterner<Interner = I> + TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for Canonical<T>where
I: Interner,
T: HasInterner<Interner = I> + TypeVisitable<I>,
§fn visit_with<B>(
&self,
visitor: &mut dyn TypeVisitor<I, BreakTy = B>,
outer_binder: DebruijnIndex,
) -> ControlFlow<B>
fn visit_with<B>( &self, visitor: &mut dyn TypeVisitor<I, BreakTy = B>, outer_binder: DebruijnIndex, ) -> ControlFlow<B>
Apply the given visitor
visitor
to self
; binders
is the
number of binders that are in scope when beginning the
visitor. Typically binders
starts as 0, but is adjusted when
we encounter Binders<T>
in the IR or other similar
constructs.