flag to dump proc-macro's generated tokenstream to file for debugging #124860
Labels
A-proc-macros
Area: Procedural macros
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I think it would be useful for rustc to have flags to dump a proc-macro's generated tokenstream to a file when rustc generates an error or if you choose to always dump the macro's output.
the existing
Zunpretty=expanded
flag is not suitable because it fails if rustc can't parse the generated tokenstream, it expands all macros in the generated tokenstream instead of showing exactly what the proc-macro generated, and it usually generates a huge amount of output which makes finding the output of any particular proc macro invocation very annoying.This came up here where the workaround I'm currently using is inspired by iirc https://github.com/drahnr/expander where the proc-macro writes an output file itself and generates
include!("path/to/generated/file.rs")
The text was updated successfully, but these errors were encountered: