We have the ability to serialize the AST, we should use it! Probably --emit-ast would dump JSON after phase 2.
--emit-ast
For anyone who googles rust dump ast and lands here (and doesn't look at the commit that closed this), it's rustc -Z ast-json foo.rs
rust dump ast
rustc -Z ast-json foo.rs
Most helpful comment
For anyone who googles
rust dump ast
and lands here (and doesn't look at the commit that closed this), it'srustc -Z ast-json foo.rs