mirror of https://github.com/rust-lang/rfcs.git
Update 1211-mir.md
This commit is contained in:
parent
84f5061175
commit
76df743871
|
@ -211,15 +211,15 @@ representation from an AST-like form.
|
|||
|
||||
For increased flexibility, as well as to make the code simpler, the
|
||||
prototype is not coded directly against the compiler's AST, but rather
|
||||
against an idealized representation defined by [the `HIR` trait][hir].
|
||||
Note that this HIR trait is entirely independent from the HIR discussed by
|
||||
against an idealized representation defined by [the `HAIR` trait][hair].
|
||||
Note that this HAIR trait is entirely independent from the HIR discussed by
|
||||
nrc in [RFC 1191][1191] -- you can think of it as an abstract trait
|
||||
that any high-level Rust IR could implement, including our current
|
||||
AST. Moreover, it's just an implementation detail and not part of the
|
||||
MIR being proposed here per se. Still, if you want to read the code,
|
||||
you have to understand its design.
|
||||
|
||||
The `HIR` trait contains a number of opaque associated types for the
|
||||
The `HAIR` trait contains a number of opaque associated types for the
|
||||
various aspects of the compiler. For example, the type `H::Expr`
|
||||
represents an expression. In order to find out what kind of expression
|
||||
it is, the `mirror` method is called, which converts an `H::Expr` into
|
||||
|
@ -229,17 +229,17 @@ themselves, or else they may be additional `H::Expr` nodes. This
|
|||
allows the tree that is exported to differ in small ways from the
|
||||
actual tree within the compiler; the primary intention is to use this
|
||||
to model "adjustments" like autoderef. The code to convert from our
|
||||
current AST to the HIR is not yet complete, but it can be found
|
||||
current AST to the HAIR is not yet complete, but it can be found
|
||||
[here][hair-mod].
|
||||
|
||||
Note that the HIR mirroring system is an experiment and not really
|
||||
Note that the HAIR mirroring system is an experiment and not really
|
||||
part of the MIR itself. It does however present an interesting option
|
||||
for (eventually) stabilizing access to the compiler's internals.
|
||||
|
||||
[crate]: https://github.com/rust-lang/rust/blob/master/src/librustc/mir
|
||||
[mir]: https://github.com/rust-lang/rust/blob/master/src/librustc/mir/mod.rs
|
||||
[build]: https://github.com/rust-lang/rust/blob/master/src/librustc_mir/build
|
||||
[hir]: https://github.com/rust-lang/rust/blob/master/src/librustc_mir/hair
|
||||
[hair]: https://github.com/rust-lang/rust/blob/master/src/librustc_mir/hair
|
||||
[1191]: https://github.com/rust-lang/rfcs/pull/1191
|
||||
[hair-mod]: https://github.com/rust-lang/rust/blob/master/src/librustc_mir/hair/mod.rs
|
||||
|
||||
|
|
Loading…
Reference in New Issue