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

Flag to control how deeply macros are expanded #11

Open
dtolnay opened this issue Feb 14, 2017 · 4 comments
Open

Flag to control how deeply macros are expanded #11

dtolnay opened this issue Feb 14, 2017 · 4 comments

Comments

@dtolnay
Copy link
Owner

dtolnay commented Feb 14, 2017

For example, avoid expanding try! and other macros inside the output of proc macros.

cc @djc

@dpc
Copy link

dpc commented Dec 27, 2018

I'd like to request this to be an arbitrary level of macro expansion. I am particularly interested in 0.

For cargo-crev I had an idea that cargo-expand could be used for a one-file view of the source code for the purpose of quick code review. I'm mostly interested in mod file conversion to mod { ... }

@dtolnay dtolnay changed the title Flag to expand only one level of macros Flag to control how deeply macros are expanded Jan 15, 2019
@dtolnay
Copy link
Owner Author

dtolnay commented Jan 22, 2019

I posted a relevant request for implementation for 0 levels: dtolnay/request-for-implementation#6.

@DevinR528
Copy link

I was thinking about this after seeing another question on the rust users forum about order of expansion, obviously this would be slightly different but I wonder if while implementing this feature one could also only expand x number of macros in order. This seems possibly helpful for people writing proc-macro's to see how they interact? If the original issue is something you want I'd take a look at it.

@kangalio
Copy link

kangalio commented Apr 1, 2021

This seems possibly helpful for people writing proc-macro's to see how they interact? If the original issue is something you want I'd take a look at it.

I'm debugging a proc macro right now which generates a declarative macro invocation. Something's wrong about the generated declarative macro invocation, but it's hard to investigate because the invocation is expanded immediately.

This would certainly be a useful feature to have, at least for debugging proc macros

Although this need could also be solved with #68, by setting the expanded crate to the proc macro crate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants