Trait rustc_typeck::middle::ty_fold::TypeFolderUnstable
[-] [+]
[src]
pub trait TypeFolder<'tcx> {
fn tcx(&'a self) -> &'a ctxt<'tcx>;
fn enter_region_binder(&mut self) { ... }
fn exit_region_binder(&mut self) { ... }
fn fold_binder<T>(&mut self, t: &Binder<T>) -> Binder<T> where T: TypeFoldable<'tcx> + Repr<'tcx> + Clone { ... }
fn fold_ty(&mut self, t: &'tcx TyS<'tcx>) -> &'tcx TyS<'tcx> { ... }
fn fold_mt(&mut self, t: &mt<'tcx>) -> mt<'tcx> { ... }
fn fold_trait_ref(&mut self, t: &TraitRef<'tcx>) -> TraitRef<'tcx> { ... }
fn fold_substs(&mut self, substs: &Substs<'tcx>) -> Substs<'tcx> { ... }
fn fold_fn_sig(&mut self, sig: &FnSig<'tcx>) -> FnSig<'tcx> { ... }
fn fold_output(&mut self, output: &FnOutput<'tcx>) -> FnOutput<'tcx> { ... }
fn fold_bare_fn_ty(&mut self, fty: &BareFnTy<'tcx>) -> BareFnTy<'tcx> { ... }
fn fold_closure_ty(&mut self, fty: &ClosureTy<'tcx>) -> ClosureTy<'tcx> { ... }
fn fold_region(&mut self, r: Region) -> Region { ... }
fn fold_existential_bounds(&mut self, s: &ExistentialBounds<'tcx>) -> ExistentialBounds<'tcx> { ... }
fn fold_autoref(&mut self, ar: &AutoRef<'tcx>) -> AutoRef<'tcx> { ... }
fn fold_item_substs(&mut self, i: ItemSubsts<'tcx>) -> ItemSubsts<'tcx> { ... }
}
The TypeFolder 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.fold_with(self)
to fold each
sub-item.
Required Methods
Provided Methods
fn enter_region_binder(&mut self)
Invoked by the super_*
routines when we enter a region
binding level (for example, when entering a function
signature). This is used by clients that want to track the
Debruijn index nesting level.
fn exit_region_binder(&mut self)
Invoked by the super_*
routines when we exit a region
binding level. This is used by clients that want to
track the Debruijn index nesting level.
fn fold_binder<T>(&mut self, t: &Binder<T>) -> Binder<T> where T: TypeFoldable<'tcx> + Repr<'tcx> + Clone
fn fold_ty(&mut self, t: &'tcx TyS<'tcx>) -> &'tcx TyS<'tcx>
fn fold_mt(&mut self, t: &mt<'tcx>) -> mt<'tcx>
fn fold_trait_ref(&mut self, t: &TraitRef<'tcx>) -> TraitRef<'tcx>
fn fold_substs(&mut self, substs: &Substs<'tcx>) -> Substs<'tcx>
fn fold_fn_sig(&mut self, sig: &FnSig<'tcx>) -> FnSig<'tcx>
fn fold_output(&mut self, output: &FnOutput<'tcx>) -> FnOutput<'tcx>
fn fold_bare_fn_ty(&mut self, fty: &BareFnTy<'tcx>) -> BareFnTy<'tcx>
fn fold_closure_ty(&mut self, fty: &ClosureTy<'tcx>) -> ClosureTy<'tcx>
fn fold_region(&mut self, r: Region) -> Region
fn fold_existential_bounds(&mut self, s: &ExistentialBounds<'tcx>) -> ExistentialBounds<'tcx>
fn fold_autoref(&mut self, ar: &AutoRef<'tcx>) -> AutoRef<'tcx>
fn fold_item_substs(&mut self, i: ItemSubsts<'tcx>) -> ItemSubsts<'tcx>
Implementors
impl<'cx, 'tcx> TypeFolder<'tcx> for Generalizer<'cx, 'tcx>
impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticTypeResolver<'a, 'tcx>
impl<'a, 'tcx> TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx>
impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx>
impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx>
impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssociatedTypeNormalizer<'a, 'b, 'tcx>
impl<'a, 'tcx, F> TypeFolder<'tcx> for BottomUpFolder<'a, 'tcx, F> where F: FnMut(&'tcx TyS<'tcx>) -> &'tcx TyS<'tcx>
impl<'a, 'tcx> TypeFolder<'tcx> for RegionFolder<'a, 'tcx>
impl<'a, 'tcx> TypeFolder<'tcx> for RegionEraser<'a, 'tcx>