Trait rustc_middle::ty::FallibleTypeFolder
source · pub trait FallibleTypeFolder<I>: Sizedwhere
I: Interner,{
type Error;
// Required method
fn interner(&self) -> I;
// Provided methods
fn try_fold_binder<T>(
&mut self,
t: <I as Interner>::Binder<T>
) -> Result<<I as Interner>::Binder<T>, Self::Error>
where T: TypeFoldable<I>,
<I as Interner>::Binder<T>: TypeSuperFoldable<I> { ... }
fn try_fold_ty(
&mut self,
t: <I as Interner>::Ty
) -> Result<<I as Interner>::Ty, Self::Error>
where <I as Interner>::Ty: TypeSuperFoldable<I> { ... }
fn try_fold_region(
&mut self,
r: <I as Interner>::Region
) -> Result<<I as Interner>::Region, Self::Error> { ... }
fn try_fold_const(
&mut self,
c: <I as Interner>::Const
) -> Result<<I as Interner>::Const, Self::Error>
where <I as Interner>::Const: TypeSuperFoldable<I> { ... }
fn try_fold_predicate(
&mut self,
p: <I as Interner>::Predicate
) -> Result<<I as Interner>::Predicate, Self::Error>
where <I as Interner>::Predicate: TypeSuperFoldable<I> { ... }
}
Expand description
This trait is implemented for every folding traversal. There is a fold method defined for every type of interest. Each such method has a default that does an “identity” fold.
A blanket implementation of this trait (that defers to the relevant
method of TypeFolder
) is provided for all infallible folders in
order to ensure the two APIs are coherent.