Rust 代码编译为源码的过程:
AST -> HIR -> MIR -> LLVM IR -> xxxx
一些类型检查 所有权检查 是在 HIR、MIR 阶段处理的。
显示 hir
rustc -Zinspect=hir file.rs
error: the option `Z` is only accepted on the nightly compiler
显示 mir
play.rust-lang.org/ 功能很强大,能显示rust 源码的 MIR、 LLVM IR、Wasm 等不同类型的格式。
参考:
rust-lang.github.io/rustc-guide…
