Trait rustc_trait_selection::infer::canonical::ir::fold::TypeFolder

source ·
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: Binder<I, T>) -> Binder<I, T> where T: TypeFoldable<I> { ... } fn fold_ty(&mut self, t: <I as Interner>::Ty) -> <I as Interner>::Ty { ... } fn fold_region( &mut self, r: <I as Interner>::Region, ) -> <I as Interner>::Region { ... } fn fold_const( &mut self, c: <I as Interner>::Const, ) -> <I as Interner>::Const { ... } fn fold_predicate( &mut self, p: <I as Interner>::Predicate, ) -> <I as Interner>::Predicate { ... } }
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: Binder<I, T>) -> Binder<I, T>
where T: TypeFoldable<I>,

source

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

source

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

source

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

source

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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

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

source§

fn interner(&self) -> TyCtxt<'tcx>

source§

fn fold_binder<T>( &mut self, t: Binder<TyCtxt<'tcx>, T>, ) -> Binder<TyCtxt<'tcx>, T>
where T: TypeFoldable<TyCtxt<'tcx>>,

source§

fn fold_region(&mut self, r: Region<'tcx>) -> Region<'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>,

source§

fn interner(&self) -> TyCtxt<'tcx>

source§

fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx>

source§

fn fold_region(&mut self, r: Region<'tcx>) -> Region<'tcx>

source§

fn fold_const(&mut self, ct: Const<'tcx>) -> Const<'tcx>

source§

impl<Infcx, I> TypeFolder<I> for Canonicalizer<'_, Infcx, I>
where Infcx: InferCtxtLike<Interner = I>, I: Interner,

source§

fn interner(&self) -> I

source§

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

source§

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

source§

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

source§

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

source§

impl<Infcx, I> TypeFolder<I> for EagerResolver<'_, Infcx, I>
where Infcx: InferCtxtLike<Interner = I>, I: Interner,

source§

fn interner(&self) -> I

source§

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

source§

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

source§

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

Implementors§

source§

impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx>

source§

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

source§

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

source§

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

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for DeeplyNormalizeForDiagnosticsFolder<'_, 'tcx>

source§

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

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx>

source§

impl<'tcx> TypeFolder<TyCtxt<'tcx>> for PlaceholderReplacer<'_, 'tcx>

source§

impl<Infcx, I> TypeFolder<I> for ReplaceAliasWithInfer<'_, '_, Infcx, I>
where Infcx: InferCtxtLike<Interner = I>, I: Interner,

source§

impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> for ReplaceProjectionWith<'_, Infcx, I>