TypeSuperFoldable in rustc_type_ir::fold - Rust
Description: API documentation for the Rust `TypeSuperFoldable` trait in crate `rustc_type_ir`.

Skip to main content

## TypeSuperFoldable

# Trait TypeSuperFoldable

Source

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

## Required Methods§

Source

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

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)`.

Source

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

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".

## Implementors§

Source§

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