pub trait FallibleTypeFolder<'tcx>: Sized {
    type Error;

    fn tcx<'a>(&'a self) -> TyCtxt<'tcx>;

    fn try_fold_binder<T>(
        &mut self,
        t: Binder<'tcx, T>
    ) -> Result<Binder<'tcx, T>, Self::Error>
        T: TypeFoldable<'tcx>
, { ... } fn try_fold_ty(&mut self, t: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> { ... } fn try_fold_region(
        &mut self,
        r: Region<'tcx>
    ) -> Result<Region<'tcx>, Self::Error> { ... } fn try_fold_const(
        &mut self,
        c: Const<'tcx>
    ) -> Result<Const<'tcx>, Self::Error> { ... } fn try_fold_predicate(
        &mut self,
        p: Predicate<'tcx>
    ) -> Result<Predicate<'tcx>, 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§

Provided Methods§