Skip to content

Commit 92499ea

Browse files
camelidtshepang
authored andcommitted
Clarify section on MIR construction
1 parent 401abb9 commit 92499ea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/mir/construction.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
The lowering of [HIR] to [MIR] occurs for the following (probably incomplete)
44
list of items:
55

6-
* Function and Closure bodies
6+
* Function and closure bodies
77
* Initializers of `static` and `const` items
88
* Initializers of enum discriminants
9-
* Glue and Shims of any kind
9+
* Glue and shims of any kind
1010
* Tuple struct initializer functions
1111
* Drop code (the `Drop::drop` function is not called directly)
1212
* Drop implementations of types without an explicit `Drop` implementation
@@ -20,9 +20,10 @@ without explicit syntax) like coercions, autoderef, autoref and overloaded metho
2020
calls have become explicit casts, deref operations, reference expressions or
2121
concrete function calls.
2222

23-
The [THIR] has datatypes that mirror the [HIR] datatypes, but instead of e.g. `-x`
24-
being a `thir::ExprKind::Neg(thir::Expr)` it is a `thir::ExprKind::Neg(hir::Expr)`.
25-
This shallowness enables the `THIR` to represent all datatypes that [HIR] has, but
23+
The [THIR] has datatypes that mirror the [HIR] datatypes, but the [THIR] is a shallow
24+
wrapper around [HIR]. For example, instead of `-x` being a `thir::ExprKind::Neg(thir::Expr)`
25+
(a deep copy), it is a `thir::ExprKind::Neg(hir::Expr)` (a shallow copy).
26+
This shallowness enables the [THIR] to represent all datatypes that [HIR] has, but
2627
without having to create an in-memory copy of the entire [HIR].
2728
[MIR] lowering will first convert the topmost expression from
2829
[HIR] to [THIR] (in [`rustc_mir_build::thir::cx::expr`]) and then process

0 commit comments

Comments
 (0)