(待补充完善)Rust MIR

2,362 阅读1分钟

Rust 代码编译为源码的过程:

AST -> HIR -> MIR -> LLVM IR -> xxxx

Rust 与 LLVM简单介绍

一些类型检查 所有权检查 是在 HIRMIR 阶段处理的。

显示 hir

rustc -Zinspect=hir file.rs

error: the option `Z` is only accepted on the nightly compiler

显示 mir

play.rust-lang.org/ 功能很强大,能显示rust 源码的 MIRLLVM IRWasm 等不同类型的格式。


参考:

rust-lang.github.io/rustc-guide…

jonathansteyfkens.com/posts/explo…

www.reddit.com/r/rust/comm…

github.com/mre/cargo-i…