Skip to content

Commit 2bd5354

Browse files
alexcameron89mark-i-m
authored andcommitted
Define HIR more specifically
IR is a foreign acronym to me, so having it fully expressed in the beginning as Intermediate Representation helps me comprehend the subject.
1 parent 2dc19d0 commit 2bd5354

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/high-level-overview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ take:
104104
nodes, and hence may strip things out of the AST as well.
105105
3. **Lowering to HIR**
106106
- Once name resolution completes, we convert the AST into the HIR,
107-
or "high-level IR". The HIR is defined in `src/librustc/hir/`;
108-
that module also includes the lowering code.
107+
or "[high-level intermediate representation]". The HIR is defined in
108+
`src/librustc/hir/`; that module also includes the lowering code.
109109
- The HIR is a lightly desugared variant of the AST. It is more processed
110110
than the AST and more suitable for the analyses that follow.
111111
It is **not** required to match the syntax of the Rust language.
@@ -138,3 +138,4 @@ take:
138138

139139

140140
[query model]: query.html
141+
[high-level intermediate representation]: hir.html

src/hir.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# The HIR
22

3-
The HIR – "High-level IR" – is the primary IR used in most of rustc. It is a
4-
compiler-friendly representation of the abstract syntax tree (AST) that is
5-
generated after parsing, macro expansion, and name resolution.
6-
Many parts of HIR resemble Rust surface syntax quite closely, with the
7-
exception that some of Rust's expression forms have been desugared away. For
3+
The HIR – "High-Level Intermediate Representation" – is the primary IR used in
4+
most of rustc. It is a compiler-friendly representation of the abstract syntax
5+
tree (AST) that is generated after parsing, macro expansion, and name
6+
resolution. Many parts of HIR resemble Rust surface syntax quite closely, with
7+
the exception that some of Rust's expression forms have been desugared away. For
88
example, `for` loops are converted into a `loop` and do not appear in the HIR.
99
This makes HIR more amenable to analysis than a normal AST.
1010

0 commit comments

Comments
 (0)