Way to step in macro_rule?


Is there a way to debug step by step a macro_rule? Right now, when debugging, the whole macro is skipped (but executed). "Step into" happily skips it.

fn main() {
    macro_rules! kut {
        () => {



Right now, I have to manuallly click on kut!(), ask rust-analyzer to expand recursively, copy/paste, comment out the kut!(); and debug.

Also, I can't put breakpoints inside the macro_rules scope.

That's inconvenient.

I use VS Code + LLDB, nightly rust toolchain.

Is there a quicker way to do it (if at all)?


This does not answer the question you asked, but does GitHub - dtolnay/cargo-expand: Subcommand to show result of macro expansion solve your problem? Generally I find just staring at the output to be most efficient.

I tried this extension but it does the same as rust-analyzer.

I changed my route and just call a function inside the macro for now.

Then, I have the usual debugging experience.. But an "in-place" expansion would be nice to have while debugging.. If some Jetbrain or Microsoft hackers read this..

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.