Expand description
Traits for transforming bits of IR.
Re-exports
pub use self::shift::Shift;
Modules
Shifting of debruijn indices
Structs
Substitution used during folding
Traits
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
FallibleTypeFolder
, will reconstruct itself, invoking the folder’s
methods to transform each of the types/lifetimes embedded within.Applies the given
TypeFolder
to a value, producing a folded result
of type 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 T::Result
).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
TypeFolder
, the
TypeSuperFoldable
trait captures the recursive behavior that folds all
the contents of the type.