@@ -13,18 +13,21 @@ by T-lang.
13
13
14
14
## How does it work?
15
15
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:
18
17
19
- ### AST and HIR
18
+ 1 . AST lowering (AST -> HIR)
19
+ 2 . HIR ty lowering (HIR -> rustc_middle::ty data types)
20
+ 3 . typeck
20
21
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
22
25
still lower them as
23
26
[ ` hir::ItemKind::OpaqueTy ` ] ( https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.OpaqueTy.html ) .
24
27
The two differences are that:
25
28
26
29
We 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.
28
31
29
32
We record ` lifetime_mapping ` s for the opaque type, described below.
30
33
@@ -49,7 +52,7 @@ bounds that enforce equality between these duplicated lifetimes and
49
52
their source lifetimes in order to properly typecheck these GATs, which
50
53
will be discussed below.
51
54
52
- ##### note:
55
+ ##### Note
53
56
54
57
It may be better if we were able to lower without duplicates and for
55
58
that I think we would need to stop distinguishing between early and late
@@ -59,14 +62,14 @@ late-bound lifetimes in generics
59
62
PR similar to [ Inherit function lifetimes for impl-trait
60
63
#103449 ] ( https://github.com/rust-lang/rust/pull/103449 ) .
61
64
62
- ### Astconv
65
+ ### HIR ty lowering
63
66
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
66
69
synthesized def-id for a new associated type in the trait. We'll
67
70
describe how exactly we get this def-id in the next section.
68
71
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
70
73
getting a projection back instead of an opaque. This projection can then
71
74
be normalized to the right value -- either the original opaque if we're
72
75
in the trait, or the inferred type of the RPITIT if we're in an impl.
0 commit comments