1
Fork 0
rust/compiler/rustc_middle/src
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
..
dep_graph Show a more informative panic message when DefPathHash does not exist 2022-01-19 17:36:44 -05:00
hir Make all hir::Map methods consistently by-value 2022-02-10 11:54:06 +01:00
infer Inline UnifyKey::index and UnifyKey::from_index 2022-02-15 19:07:06 +01:00
middle Auto merge of #93511 - cjgillot:query-copy, r=oli-obk 2022-02-10 09:37:07 +00:00
mir Rollup merge of #94020 - tmiasko:pp, r=oli-obk 2022-02-16 18:59:32 +01:00
query Support pretty printing of invalid constants 2022-02-16 00:38:59 +01:00
thir use AllocId and Ty in ExprKind::StaticRef and delay ConstValue construction 2022-02-15 21:18:33 +01:00
traits Ensure that queries only return Copy types. 2022-02-09 20:07:38 +01:00
ty Rollup merge of #93758 - nnethercote:improve-folding-comments, r=BoxyUwU 2022-02-17 23:00:55 +01:00
util Use AddAssign impl 2021-11-09 23:47:36 +01:00
arena.rs Overhaul Const. 2022-02-15 16:19:59 +11:00
lib.rs add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
lint.rs update FutureIncompatibilityReason 2022-02-01 09:55:19 +01:00
macros.rs Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
metadata.rs rustc_middle: Rename Export to ModChild and add some comments 2022-01-09 09:22:07 +08:00
tests.rs
thir.rs try to bless 32bit mir tests manually 2022-02-15 22:24:53 +01:00