Trait rustc_middle::ty::fold::FallibleTypeFolder [−][src]
pub trait FallibleTypeFolder<'tcx>: TypeFolder<'tcx> {
fn try_fold_binder<T>(
&mut self,
t: Binder<'tcx, T>
) -> Result<Binder<'tcx, T>, Self::Error>
where
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: &'tcx Const<'tcx>
) -> Result<&'tcx Const<'tcx>, Self::Error> { ... }
fn try_fold_predicate(
&mut self,
p: Predicate<'tcx>
) -> Result<Predicate<'tcx>, Self::Error> { ... }
fn try_fold_mir_const(
&mut self,
c: ConstantKind<'tcx>
) -> Result<ConstantKind<'tcx>, Self::Error> { ... }
}Expand description
The FallibleTypeFolder trait defines the actual folding. There is a
method defined for every foldable type. Each of these has a
default implementation that does an “identity” fold. Within each
identity fold, it should invoke foo.try_fold_with(self) to fold each
sub-item.
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.
