Traits for transforming bits of IR.
This module contains impls of
TypeFoldable for those types that
This module contains “rote and uninteresting” impls of
various types. In general, we prefer to derive
sometimes that doesn’t work for whatever reason.
Subroutines to help implementers of
TypeFoldable avoid unnecessary heap allocations.
Shifting of debruijn indices
Substitution used during folding
Applies the given
TypeFolder to a value, producing a folded result
Self::Result. The result type is typically the same as
the source type, but in some cases we convert from borrowed
to owned as well (e.g., the folder for
&T will fold to a fresh
T; well, actually
A “folder” is a transformer that can be used to make a copy of
some term – that is, some bit of IR, such as a
Goal – with
certain changes applied. The idea is that it contains methods that
let you swap types/lifetimes for new types/lifetimes; meanwhile,
each bit of IR implements the
TypeFoldable trait which, given a
TypeFolder, will reconstruct itself, invoking the folder’s methods
to transform each of the types/lifetimes embedded within.
For types where “fold” invokes a callback on the
TypeSuperFoldable trait captures the recursive behavior that folds all
the contents of the type.