Skip to content

Commit 4a705f9

Browse files
committed
Rewrite the "representing types" section to be more comprehensive
1 parent ea35ee8 commit 4a705f9

11 files changed

+508
-342
lines changed

src/SUMMARY.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,20 @@
119119
- [Early vs Late bound parameters](./early-late-bound-params/early-late-bound-summary.md)
120120
- [Implementation nuances of early/late bound parameters](./early-late-bound-params/early-late-bound-implementation-nuances.md)
121121
- [Interactions with turbofishing](./early-late-bound-params/turbofishing-and-early-late-bound.md)
122-
- [`TypeFolder` and `TypeFoldable`](./ty-fold.md)
123-
- [Generic arguments](./generic_arguments.md)
122+
- [The `ty` module: representing types](./ty.md)
123+
- [ADTs and Generic Arguments](./ty_module/generic_arguments.md)
124+
- [Parameter types/consts/regions](./ty_module/param_ty_const_regions.md)
125+
- [`EarlyBinder` and instantiating parameters](./ty_module/early_binder.md)
126+
- [`Binder` and Higher ranked regions](./ty_module/binders.md)
127+
- [Instantiating binders](./ty_module/instantiating_binders.md)
124128
- [Constants in the type system](./constants.md)
125-
- [Bound vars and Parameters](./bound-vars-and-params.md)
129+
- [`TypeFolder` and `TypeFoldable`](./ty-fold.md)
126130
- [Parameter Environments](./param_env/param_env_summary.md)
127131
- [What is it?](./param_env/param_env_what_is_it.md)
128132
- [How are `ParamEnv`'s constructed internally](./param_env/param_env_construction_internals.md)
129133
- [Which `ParamEnv` do I use?](./param_env/param_env_acquisition.md)
130134
- [Type inference](./type-inference.md)
131135
- [Trait solving](./traits/resolution.md)
132-
- [Early and Late Bound Parameter Definitions](./early-late-bound-params/early-late-bound-summary.md)
133-
- [Implementation nuances of early/late bound parameters](./early-late-bound-params/early-late-bound-implementation-nuances.md)
134-
- [Interactions with turbofishing](./early-late-bound-params/turbofishing-and-early-late-bound.md)
135136
- [Higher-ranked trait bounds](./traits/hrtb.md)
136137
- [Caching subtleties](./traits/caching.md)
137138
- [Implied bounds](./traits/implied-bounds.md)

src/bound-vars-and-params.md

-59
This file was deleted.

src/generic_arguments.md

-50
This file was deleted.

src/generics.md

-144
This file was deleted.

src/ty-fold.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# `TypeFoldable` and `TypeFolder`
22

3-
How is this `subst` query actually implemented? As you can imagine, we might want to do
4-
substitutions on a lot of different things. For example, we might want to do a substitution directly
5-
on a type like we did with `Vec` above. But we might also have a more complex type with other types
6-
nested inside that also need substitutions.
3+
In the previous chapter we discussed instantiating binders. This must involves looking at everything inside of a `Early/Binder`
4+
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
5+
how do we implement the `instantiate` methods on the `Early/Binder` types.
76

87
The answer is a couple of traits:
98
[`TypeFoldable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFoldable.html)

0 commit comments

Comments
 (0)