-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Investigate proc_macro::quote_span
integration
#184
Comments
cc @dtolnay - does the overall idea of supporting this in |
If I understand correctly, you are asking to reimplement |
It should be possible to get most of the benefit of Lines 1047 to 1049 in cbe5ded
We would pass the captured quote_helper::quote_with_span!($ident) The macro implementation would call This would allow the rest of |
Nice, that sounds promising -- but I would like this to be done as a different crate for now. |
I'll close since I am not planning on pursuing this in |
With PR rust-lang/rust#84278, Rust now has the ability to quote a
Span
to aTokenStream
. This allows us to obtain spans pointing into a proc-macro crate:Currently, this is integrated with the unstable
proc_macro::quote!
macro. However, as virtually everyone uses thequote
crate instead, it would be nice to add span-quoting support here (behind a nightly feature).The span-quoting API is used via
proc_macro::quote_span
, and produces aTokenStream
. I've provided an example of using it here.I'm not sure how to best way to integrate this API into the
quote
crate, since it looks like aSpan
parameter isn't passed around in many places (presumably for performance reasons). However, I'd be happy to work on a PR if you support the overall idea, and know the general shape of the modifications that you'd like.The text was updated successfully, but these errors were encountered: