Skip to content

Commit d89c8c9

Browse files
JohnTitormark-i-m
authored andcommitted
Rename HAIR to THIR
1 parent 5d8a8c8 commit d89c8c9

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
- [Lowering AST to HIR](./lowering.md)
8181
- [Debugging](./hir-debugging.md)
8282
- [The MIR (Mid-level IR)](./mir/index.md)
83-
- [HAIR and MIR construction](./mir/construction.md)
83+
- [THIR and MIR construction](./mir/construction.md)
8484
- [MIR visitor and traversal](./mir/visitor.md)
8585
- [MIR passes: getting the MIR for a function](./mir/passes.md)
8686
- [Closure expansion](./closure.md)

src/borrow_check/two_phase_borrows.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The activation points are found using the [`GatherBorrows`] visitor. The
7474
borrow.
7575

7676
[`AutoBorrow`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/adjustment/enum.AutoBorrow.html
77-
[converted]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/hair/cx/expr/trait.ToBorrowKind.html#method.to_borrow_kind
77+
[converted]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/thir/cx/expr/trait.ToBorrowKind.html#method.to_borrow_kind
7878
[`BorrowKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BorrowKind.html
7979
[`GatherBorrows`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/visit/trait.Visitor.html#method.visit_local
8080
[`BorrowData`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/borrow_check/borrow_set/struct.BorrowData.html

src/mir/construction.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HAIR and MIR construction
1+
# THIR and MIR construction
22

33
The lowering of [HIR] to [MIR] occurs for the following (probably incomplete)
44
list of items:
@@ -13,19 +13,19 @@ list of items:
1313

1414
The lowering is triggered by calling the [`mir_built`] query.
1515
There is an intermediate representation
16-
between [HIR] and [MIR] called the [HAIR] that is only used during the lowering.
17-
The [HAIR]'s most important feature is that the various adjustments (which happen
16+
between [HIR] and [MIR] called the [THIR] that is only used during the lowering.
17+
The [THIR]'s most important feature is that the various adjustments (which happen
1818
without explicit syntax) like coercions, autoderef, autoref and overloaded method
1919
calls have become explicit casts, deref operations, reference expressions or
2020
concrete function calls.
2121

22-
The [HAIR] has datatypes that mirror the [HIR] datatypes, but instead of e.g. `-x`
23-
being a `hair::ExprKind::Neg(hair::Expr)` it is a `hair::ExprKind::Neg(hir::Expr)`.
24-
This shallowness enables the `HAIR` to represent all datatypes that [HIR] has, but
22+
The [THIR] has datatypes that mirror the [HIR] datatypes, but instead of e.g. `-x`
23+
being a `thir::ExprKind::Neg(thir::Expr)` it is a `thir::ExprKind::Neg(hir::Expr)`.
24+
This shallowness enables the `THIR` to represent all datatypes that [HIR] has, but
2525
without having to create an in-memory copy of the entire [HIR].
2626
[MIR] lowering will first convert the topmost expression from
27-
[HIR] to [HAIR] (in [`rustc_mir_build::hair::cx::expr`]) and then process
28-
the [HAIR] expressions recursively.
27+
[HIR] to [THIR] (in [`rustc_mir_build::thir::cx::expr`]) and then process
28+
the [THIR] expressions recursively.
2929

3030
The lowering creates local variables for every argument as specified in the signature.
3131
Next it creates local variables for every binding specified (e.g. `(a, b): (i32, String)`)
@@ -152,7 +152,7 @@ case of `enum`s.
152152

153153
[MIR]: ./index.html
154154
[HIR]: ../hir.html
155-
[HAIR]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/hair/index.html
155+
[THIR]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/thir/index.html
156156

157-
[`rustc_mir_build::hair::cx::expr`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/hair/cx/expr/index.html
157+
[`rustc_mir_build::thir::cx::expr`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/thir/cx/expr/index.html
158158
[`mir_built`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/build/fn.mir_built.html

src/overview.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ we'll talk about that later.
5555
- `stmt.rs`
5656
- This naming scheme is used across many compiler stages. You will find
5757
either a file or directory with the same name across the parsing, lowering,
58-
type checking, HAIR lowering, and MIR building sources.
58+
type checking, THIR lowering, and MIR building sources.
5959
- Macro expansion, AST validation, name resolution, and early linting takes place
6060
during this stage of the compile process.
6161
- The parser uses the standard `DiagnosticBuilder` API for error handling, but we
@@ -69,8 +69,8 @@ we'll talk about that later.
6969
- **TODO: Maybe some other things are done here? I think initial type checking
7070
happens here? And trait solving?**
7171
- The HIR is then [lowered to Mid-Level Intermediate Representation (MIR)][mir].
72-
- Along the way, we construct the HAIR, which is an even more desugared HIR.
73-
HAIR is used for pattern and exhaustiveness checking. It is also more
72+
- Along the way, we construct the THIR, which is an even more desugared HIR.
73+
THIR is used for pattern and exhaustiveness checking. It is also more
7474
convenient to convert into MIR than HIR is.
7575
- The MIR is used for [borrow checking].
7676
- We (want to) do [many optimizations on the MIR][mir-opt] because it is still
@@ -187,10 +187,10 @@ for different purposes:
187187
- High-level IR (HIR): This is a sort of desugared AST. It's still close
188188
to what the user wrote syntactically, but it includes some implicit things
189189
such as some elided lifetimes, etc. This IR is amenable to type checking.
190-
- HAIR: This is an intermediate between HIR and MIR. It is like the HIR but it
191-
is fully typed and a bit more desugared (e.g. method calls and implicit
190+
- Typed HIR (THIR): This is an intermediate between HIR and MIR. It is like the HIR
191+
but it is fully typed and a bit more desugared (e.g. method calls and implicit
192192
dereferences are made fully explicit). Moreover, it is easier to lower to MIR
193-
from HAIR than from HIR.
193+
from THIR than from HIR.
194194
- Middle-level IR (MIR): This IR is basically a Control-Flow Graph (CFG). A CFG
195195
is a type of diagram that shows the basic blocks of a program and how control
196196
flow can go between them. Likewise, MIR also has a bunch of basic blocks with

0 commit comments

Comments
 (0)