Is there a way to enable backtraces for panics that occur inside a procedural macro?
I have a fairly complicated macro which includes a lot of parse_quote!
calls. Currently, one or more are panicking, presumably due to bad syntax. The only way I can figure out which is causing this is by commenting out code until the error stops, then toggling the comments to narrow in on the specific line.
I can't use cargo expand
because the macro panics before it emits anything useful, so the effected code is just removed from the command's output.
RUST_BACKTRACE=1
has no effect. RUSTFLAGS="-Z macro-backtrace"
also has no effect.
The error message just prints out a very basic message:
error: custom attribute panicked
--> [insert file here]:57:1
|
57 | #[entity]
| ^^^^^^^^^
|
= help: message: expected `,`