Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow showing the expanded macros of only a given module / source file #46091

Open
Boscop opened this issue Nov 19, 2017 · 2 comments
Open

Allow showing the expanded macros of only a given module / source file #46091

Boscop opened this issue Nov 19, 2017 · 2 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@Boscop
Copy link

Boscop commented Nov 19, 2017

When working with many macros, looking at the expanded macro output of the whole crate doesn't scale.

There should be an option to only show the expanded macros from a given module / source file.

E.g. in one case I have 81733 lines in the expanded macro output from cargo rustc -- -Z unstable-options --pretty=expanded...

@dtolnay
Copy link
Member

dtolnay commented Nov 19, 2017

I should have reported this when dtolnay/cargo-expand#8 was filed, but 👍 from me and 👍👍👍👍👍👍👍👍👍👍👍👍 from 12 people over there.

@TimNN TimNN added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Nov 21, 2017
@dtolnay
Copy link
Member

dtolnay commented Jan 14, 2019

I implemented a workaround in cargo-expand 0.4 for now by filtering the compiler's output through Syn. For example you can run:

expand contents of one module:

$ cargo expand punctuated::printing

expand a single item (struct, function, trait, etc):

$ cargo expand token::FatArrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

3 participants