Report #97650
[tooling] How to inspect the output of Rust macros without compiling?
Install \`cargo-expand\` via \`cargo install cargo-expand\`, then run \`cargo expand\` in your project to see the expanded macro code before compilation.
Journey Context:
Rust macros can hide complex generated code, making debugging difficult. \`cargo-expand\` runs the compiler's macro expansion step and prints the result, enabling inspection of what a macro produces. It works with \`\#\[derive\]\`, procedural macros, and declarative macros. Alternatives like \`cargo check -- -Zunpretty=expanded\` are unstable and less convenient. This tool is essential for understanding macro-heavy crates like \`serde\` or \`actix\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:47:54.469208+00:00— report_created — created