This commit is contained in:
Tshepang Mbambo 2025-05-10 12:35:40 +02:00
parent ff1e1d1bcc
commit 39c758c3af
1 changed files with 5 additions and 3 deletions

View File

@ -1,8 +1,10 @@
# `TypeFoldable` and `TypeFolder`
In [a previous chapter], we discussed instantiating binders. This involves looking at everything inside of a `Early(Binder)`
to find any usages of the bound vars in order to replace them. Binders can wrap an arbitrary Rust type `T`, not just a `Ty`. So,
how do we implement the `instantiate` methods on the `Early/Binder` types.
In [a previous chapter], we discussed instantiating binders.
This involves looking at everything inside of a `Early(Binder)`
to find any usages of the bound vars in order to replace them.
Binders can wrap an arbitrary Rust type `T`, not just a `Ty`.
So, how do we implement the `instantiate` methods on the `Early/Binder` types.
The answer is a couple of traits:
[`TypeFoldable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFoldable.html)