rustc_trait_selection::infer::canonical::ir::fold

Trait TypeSuperFoldable

Source
pub trait TypeSuperFoldable<I>: TypeFoldable<I>
where I: Interner,
{ // Required method fn try_super_fold_with<F>( self, folder: &mut F, ) -> Result<Self, <F as FallibleTypeFolder<I>>::Error> where F: FallibleTypeFolder<I>; // Provided method fn super_fold_with<F>(self, folder: &mut F) -> Self where F: TypeFolder<I> { ... } }

Required Methods§

Source

fn try_super_fold_with<F>( self, folder: &mut F, ) -> Result<Self, <F as FallibleTypeFolder<I>>::Error>
where F: FallibleTypeFolder<I>,

Provides a default fold for a recursive type of interest. This should only be called within TypeFolder methods, when a non-custom traversal is desired for the value of the type of interest passed to that method. For example, in MyFolder::try_fold_ty(ty), it is valid to call ty.try_super_fold_with(self), but any other folding should be done with xyz.try_fold_with(self).

Provided Methods§

Source

fn super_fold_with<F>(self, folder: &mut F) -> Self
where F: TypeFolder<I>,

A convenient alternative to try_super_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_super_fold_with.

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.

Implementations on Foreign Types§

Source§

impl<'tcx> TypeSuperFoldable<TyCtxt<'tcx>> for Const<'tcx>

Source§

fn try_super_fold_with<F>( self, folder: &mut F, ) -> Result<Const<'tcx>, <F as FallibleTypeFolder<TyCtxt<'tcx>>>::Error>
where F: FallibleTypeFolder<TyCtxt<'tcx>>,

Source§

impl<'tcx> TypeSuperFoldable<TyCtxt<'tcx>> for Predicate<'tcx>

Source§

fn try_super_fold_with<F>( self, folder: &mut F, ) -> Result<Predicate<'tcx>, <F as FallibleTypeFolder<TyCtxt<'tcx>>>::Error>
where F: FallibleTypeFolder<TyCtxt<'tcx>>,

Source§

impl<'tcx> TypeSuperFoldable<TyCtxt<'tcx>> for Ty<'tcx>

Source§

fn try_super_fold_with<F>( self, folder: &mut F, ) -> Result<Ty<'tcx>, <F as FallibleTypeFolder<TyCtxt<'tcx>>>::Error>
where F: FallibleTypeFolder<TyCtxt<'tcx>>,

Implementors§

Source§

impl<I, T> TypeSuperFoldable<I> for Binder<I, T>
where I: Interner, T: TypeFoldable<I>,