pub trait TypeFolder<I>: FallibleTypeFolder<I, Error = !>where
    I: Interner,{
    // Required method
    fn interner(&self) -> I;

    // Provided methods
    fn fold_binder<T>(
        &mut self,
        t: <I as Interner>::Binder<T>
    ) -> <I as Interner>::Binder<T>
       where T: TypeFoldable<I>,
             <I as Interner>::Binder<T>: TypeSuperFoldable<I> { ... }
    fn fold_ty(&mut self, t: <I as Interner>::Ty) -> <I as Interner>::Ty
       where <I as Interner>::Ty: TypeSuperFoldable<I> { ... }
    fn fold_region(
        &mut self,
        r: <I as Interner>::Region
    ) -> <I as Interner>::Region
       where <I as Interner>::Region: TypeSuperFoldable<I> { ... }
    fn fold_const(&mut self, c: <I as Interner>::Const) -> <I as Interner>::Const
       where <I as Interner>::Const: TypeSuperFoldable<I> { ... }
    fn fold_predicate(
        &mut self,
        p: <I as Interner>::Predicate
    ) -> <I as Interner>::Predicate
       where <I as Interner>::Predicate: TypeSuperFoldable<I> { ... }
}
Expand description

This trait is implemented for every infallible folding traversal. There is a fold method defined for every type of interest. Each such method has a default that does an “identity” fold. Implementations of these methods often fall back to a super_fold_with method if the primary argument doesn’t satisfy a particular condition.

A blanket implementation of FallibleTypeFolder will defer to the infallible methods of this trait to ensure that the two APIs are coherent.

Required Methods§

source

fn interner(&self) -> I

Provided Methods§

source

fn fold_binder<T>( &mut self, t: <I as Interner>::Binder<T> ) -> <I as Interner>::Binder<T>where T: TypeFoldable<I>, <I as Interner>::Binder<T>: TypeSuperFoldable<I>,

source

fn fold_ty(&mut self, t: <I as Interner>::Ty) -> <I as Interner>::Tywhere <I as Interner>::Ty: TypeSuperFoldable<I>,

source

fn fold_region(&mut self, r: <I as Interner>::Region) -> <I as Interner>::Regionwhere <I as Interner>::Region: TypeSuperFoldable<I>,

source

fn fold_const(&mut self, c: <I as Interner>::Const) -> <I as Interner>::Constwhere <I as Interner>::Const: TypeSuperFoldable<I>,

source

fn fold_predicate( &mut self, p: <I as Interner>::Predicate ) -> <I as Interner>::Predicatewhere <I as Interner>::Predicate: TypeSuperFoldable<I>,

Implementors§

source§

impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for rustc_middle::ty::print::pretty::RegionFolder<'a, 'tcx>

source§

impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for SubstFolder<'a, 'tcx>

source§

impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for rustc_middle::ty::fold::RegionFolder<'a, 'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Expander<'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RegionEraserVisitor<'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for PolymorphizationFolder<'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for NormalizeAfterErasingRegionsFolder<'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReverseMapper<'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for OpaqueTypeExpander<'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Shifter<'tcx>

source§

impl<'tcx, D> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'tcx, D>where D: BoundVarReplacerDelegate<'tcx>,

source§

impl<'tcx, F, G, H> TypeFolder<TyCtxt<'tcx>> for BottomUpFolder<'tcx, F, G, H>where F: FnMut(Ty<'tcx>) -> Ty<'tcx>, G: FnMut(Region<'tcx>) -> Region<'tcx>, H: FnMut(Const<'tcx>) -> Const<'tcx>,