@@ -13,18 +13,21 @@ by T-lang.
1313
1414## How does it work?
1515
16- This doc is ordered mostly via the compilation pipeline. AST -> HIR ->
17- astconv -> typeck.
16+ This doc is ordered mostly via the compilation pipeline:
1817
19- ### AST and HIR
18+ 1 . AST lowering (AST -> HIR)
19+ 2 . HIR ty lowering (HIR -> rustc_middle::ty data types)
20+ 3 . typeck
2021
21- AST -> HIR lowering for RPITITs is almost the same as lowering RPITs. We
22+ ### AST lowering
23+
24+ AST lowering for RPITITs is almost the same as lowering RPITs. We
2225still lower them as
2326[ ` hir::ItemKind::OpaqueTy ` ] ( https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.OpaqueTy.html ) .
2427The two differences are that:
2528
2629We record ` in_trait ` for the opaque. This will signify that the opaque
27- is an RPITIT for astconv , diagnostics that deal with HIR, etc.
30+ is an RPITIT for HIR ty lowering , diagnostics that deal with HIR, etc.
2831
2932We record ` lifetime_mapping ` s for the opaque type, described below.
3033
@@ -49,7 +52,7 @@ bounds that enforce equality between these duplicated lifetimes and
4952their source lifetimes in order to properly typecheck these GATs, which
5053will be discussed below.
5154
52- ##### note:
55+ ##### Note
5356
5457It may be better if we were able to lower without duplicates and for
5558that I think we would need to stop distinguishing between early and late
@@ -59,14 +62,14 @@ late-bound lifetimes in generics
5962PR similar to [ Inherit function lifetimes for impl-trait
6063#103449 ] ( https://github.com/rust-lang/rust/pull/103449 ) .
6164
62- ### Astconv
65+ ### HIR ty lowering
6366
64- The main change to astconv is that we lower ` hir::TyKind::OpaqueDef ` for
65- an RPITIT to a projection instead of an opaque, using a newly
67+ The main change to HIR ty lowering is that we lower ` hir::TyKind::OpaqueDef `
68+ for an RPITIT to a projection instead of an opaque, using a newly
6669synthesized def-id for a new associated type in the trait. We'll
6770describe how exactly we get this def-id in the next section.
6871
69- This means that any time we call ` ast_ty_to_ty ` on the RPITIT, we end up
72+ This means that any time we call ` lower_ty ` on the RPITIT, we end up
7073getting a projection back instead of an opaque. This projection can then
7174be normalized to the right value -- either the original opaque if we're
7275in the trait, or the inferred type of the RPITIT if we're in an impl.
0 commit comments