Trait rustc_type_ir::fold::FallibleTypeFolder
source · pub trait FallibleTypeFolder<I: Interner>: Sized {
type Error;
// Required method
fn interner(&self) -> I;
// Provided methods
fn try_fold_binder<T>(
&mut self,
t: I::Binder<T>
) -> Result<I::Binder<T>, Self::Error>
where T: TypeFoldable<I>,
I::Binder<T>: TypeSuperFoldable<I> { ... }
fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Self::Error>
where I::Ty: TypeSuperFoldable<I> { ... }
fn try_fold_region(
&mut self,
r: I::Region
) -> Result<I::Region, Self::Error> { ... }
fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Self::Error>
where I::Const: TypeSuperFoldable<I> { ... }
fn try_fold_predicate(
&mut self,
p: I::Predicate
) -> Result<I::Predicate, Self::Error>
where I::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.
Required Associated Types§
Required Methods§
Provided Methods§
fn try_fold_binder<T>( &mut self, t: I::Binder<T> ) -> Result<I::Binder<T>, Self::Error>
fn try_fold_ty(&mut self, t: I::Ty) -> Result<I::Ty, Self::Error>where
I::Ty: TypeSuperFoldable<I>,
fn try_fold_region(&mut self, r: I::Region) -> Result<I::Region, Self::Error>
fn try_fold_const(&mut self, c: I::Const) -> Result<I::Const, Self::Error>where
I::Const: TypeSuperFoldable<I>,
fn try_fold_predicate(
&mut self,
p: I::Predicate
) -> Result<I::Predicate, Self::Error>where
I::Predicate: TypeSuperFoldable<I>,
Object Safety§
This trait is not object safe.