cargo-expand
cargo-expand copied to clipboard
Flag to control how deeply macros are expanded
For example, avoid expanding try!
and other macros inside the output of proc macros.
cc @djc
I'd like to request this to be an arbitrary level of macro expansion. I am particularly interested in 0
.
For cargo-crev
I had an idea that cargo-expand
could be used for a one-file view of the source code for the purpose of quick code review. I'm mostly interested in mod file
conversion to mod { ... }
I posted a relevant request for implementation for 0 levels: https://github.com/dtolnay/request-for-implementation/issues/6.
I was thinking about this after seeing another question on the rust users forum about order of expansion, obviously this would be slightly different but I wonder if while implementing this feature one could also only expand x
number of macros in order. This seems possibly helpful for people writing proc-macro
's to see how they interact? If the original issue is something you want I'd take a look at it.
This seems possibly helpful for people writing proc-macro's to see how they interact? If the original issue is something you want I'd take a look at it.
I'm debugging a proc macro right now which generates a declarative macro invocation. Something's wrong about the generated declarative macro invocation, but it's hard to investigate because the invocation is expanded immediately.
This would certainly be a useful feature to have, at least for debugging proc macros
Although this need could also be solved with #68, by setting the expanded crate to the proc macro crate