Now that --pretty=expanded is gone, how do you debug the output of a procedural macro?


#1

I’d like to debug the code generated by a #[derive(MyCustomDerive)].

Just like this question says, you were supposed to use --pretty=expanded:

However --pretty=expanded is now gone. Someone suggested trace_macros!(true);, but that doesn’t show the expansions of custom derives.
Is there some way then, or is it a terrible overlook?


#2

Nightly still has it.

cargo +nightly rustc -- -Z unstable-options --pretty=expanded

#3

After your reply I investigated some more, and turns out you’re right.

What confused me is that rustc now entirely compiles the crate (which takes a few minutes in my case), and then only prints the macro expansion. This is something it didn’t do in the past.

Thanks