diff options
| author | Camelid <camelidcamel@gmail.com> | 2020-08-22 18:51:53 -0700 |
|---|---|---|
| committer | Tshepang Lekhonkhobe <tshepang@gmail.com> | 2020-08-26 13:13:14 +0200 |
| commit | c81541279aba017a6f3607eb07b24ba2197cea63 (patch) | |
| tree | d37f860545c1ac3e7c72aa721581d2f5137596f3 /src/doc/rustc-dev-guide | |
| parent | afc0efe2cba1e20df35544007fda35c1fb04d3c2 (diff) | |
Clarify section on MIR construction
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/mir/construction.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/doc/rustc-dev-guide/src/mir/construction.md b/src/doc/rustc-dev-guide/src/mir/construction.md index 7fe9ee8840e..2d5eef6d06d 100644 --- a/src/doc/rustc-dev-guide/src/mir/construction.md +++ b/src/doc/rustc-dev-guide/src/mir/construction.md @@ -3,10 +3,10 @@ The lowering of [HIR] to [MIR] occurs for the following (probably incomplete) list of items: -* Function and Closure bodies +* Function and closure bodies * Initializers of `static` and `const` items * Initializers of enum discriminants -* Glue and Shims of any kind +* Glue and shims of any kind * Tuple struct initializer functions * Drop code (the `Drop::drop` function is not called directly) * Drop implementations of types without an explicit `Drop` implementation @@ -20,9 +20,10 @@ without explicit syntax) like coercions, autoderef, autoref and overloaded metho calls have become explicit casts, deref operations, reference expressions or concrete function calls. -The [THIR] has datatypes that mirror the [HIR] datatypes, but instead of e.g. `-x` -being a `thir::ExprKind::Neg(thir::Expr)` it is a `thir::ExprKind::Neg(hir::Expr)`. -This shallowness enables the `THIR` to represent all datatypes that [HIR] has, but +The [THIR] has datatypes that mirror the [HIR] datatypes, but the [THIR] is a shallow +wrapper around [HIR]. For example, instead of `-x` being a `thir::ExprKind::Neg(thir::Expr)` +(a deep copy), it is a `thir::ExprKind::Neg(hir::Expr)` (a shallow copy). +This shallowness enables the [THIR] to represent all datatypes that [HIR] has, but without having to create an in-memory copy of the entire [HIR]. [MIR] lowering will first convert the topmost expression from [HIR] to [THIR] (in [`rustc_mir_build::thir::cx::expr`]) and then process |
