rustc_middle::ty

Trait FallibleTypeFolder

source
pub trait FallibleTypeFolder<I>: Sized
where I: Interner,
{ type Error; // Required method fn cx(&self) -> I; // Provided methods fn try_fold_binder<T>( &mut self, t: Binder<I, T>, ) -> Result<Binder<I, T>, Self::Error> where T: TypeFoldable<I> { ... } fn try_fold_ty( &mut self, t: <I as Interner>::Ty, ) -> Result<<I as Interner>::Ty, Self::Error> { ... } 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> { ... } fn try_fold_predicate( &mut self, p: <I as Interner>::Predicate, ) -> Result<<I as Interner>::Predicate, Self::Error> { ... } }
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§

source

fn cx(&self) -> I

Provided Methods§

source

fn try_fold_binder<T>( &mut self, t: Binder<I, T>, ) -> Result<Binder<I, T>, Self::Error>
where T: TypeFoldable<I>,

source

fn try_fold_ty( &mut self, t: <I as Interner>::Ty, ) -> Result<<I as Interner>::Ty, Self::Error>

source

fn try_fold_region( &mut self, r: <I as Interner>::Region, ) -> Result<<I as Interner>::Region, Self::Error>

source

fn try_fold_const( &mut self, c: <I as Interner>::Const, ) -> Result<<I as Interner>::Const, Self::Error>

source

fn try_fold_predicate( &mut self, p: <I as Interner>::Predicate, ) -> Result<<I as Interner>::Predicate, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§