Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Everyone is working on HIR/MIR at the moment, because it will enable a lot of different kinds of work to happen in parallel after it lands.

The stage it's in is "Niko has a draft RFC that he hasn't published yet." Then there will be discussion, and then implementation.



What's HIR/MIR?


To build on the other answer, right now, the compiler does

  AST -> LLVM IR
Which works, but you have to do all of the compilation passes and static checks on the AST. After this work is done, we'll have

  AST -> HIR -> MIR -> LLVM IR
These two intermediate representations will make it easier to write frontends and backends to Rust, as well as making it easier to implement various optimization and analysis passes, and making them faster.

Also, in today's world, for example, we can't stabilize syntax extensions because we'd have to stabilize the AST. But we _can_ stabilize {H,M}IR, much more easily. On the backside, we're very coupled to LLVM right now, and while that probably won't change, if someone wanted to write a backend, they could write their own codegen based off of MIR.


Different AST representations in Rust compiler - high level and middle level.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: