rust/compiler
Matthias Krüger 98c54c8cad
Rollup merge of #93758 - nnethercote:improve-folding-comments, r=BoxyUwU
Improve comments about type folding/visiting.

I have found this code confusing for years. I've always roughly
understood it, but never exactly. I just made my fourth(?) attempt and
finally cracked it.

This commit improves the comments. In particular, it explicitly
describes how you can't do a custom fold/visit of any type; there are
actually a handful of "types of interest" (e.g. `Ty`, `Predicate`,
`Region`, `Const`) that can be custom folded/visted, and all other types
just get a generic traversal. I think this was the part that eluded me
on all my prior attempts at understanding.

The commit also updates comments to account for some newer changes such
as the fallible/infallible folding distinction, does some minor
reorderings, and moves one `impl` to a better place.

r? `@BoxyUwU`
2022-02-17 23:00:55 +01:00
..
2022-02-15 16:19:59 +11:00
2022-02-15 16:19:59 +11:00
2022-02-15 16:19:59 +11:00
2022-02-13 11:49:52 +01:00
2022-02-13 11:49:52 +01:00
2022-02-15 16:19:59 +11:00
2022-02-15 16:19:59 +11:00
2022-02-15 16:03:24 +11:00
2022-02-15 16:19:59 +11:00
2022-02-12 11:23:53 +00:00
2022-02-15 16:19:59 +11:00
2022-02-15 16:19:59 +11:00
2022-02-15 16:19:59 +11:00
2022-02-15 16:19:59 +11:00