-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
xflags!
macro fails to expand
#16259
Comments
Turns out this desugaring only happens for declarative macros? |
Procedural macros do not quote it as raw strings, not sure why this difference exists, though. It begins here: https://github.com/rust-lang/rust/blob/8d39ec1825024f3014e1f847942ac5bbfcf055b0/compiler/rustc_expand/src/mbe/macro_rules.rs#L298 Also, I didn't do my due diligence when asserting that the function was only used for declarative macros. I'm a bit lost on where to start this fix. Any ideas on how to propagate whether the caller is expanding a declarative or procedural macro? |
We'll have to add a parameter to |
@rustbot claim |
I haven't forgotten about this issue. Just Really Busy Lately ™️. This is pretty much what was said in #16259 (comment), but you'd be surprised at the amount of places this impacts. If someone is up to it, feel free to take it, or I'll eventually come back. |
No worries, you are under no obligation to fix it :) And it doesn't seem too problematic given no issues aside from this one have been raised so far. |
It seems so. (surprising to me) I'm not familiar with the internals of the compiler, but after some digging into the code, my understanding is this: it's NOT the tt parser, but the macro engine, which desugars the doc comments into doc attributes. the ast actually keeps the original for mbe, the desugar happens here: for proc-macro, I believe it's this piece of code: note it's part of the it seems there are many different types of I suppose ra would have similar design: some internal types as representation of the parsed code, and some external types used by the macros. should ra also desugar the doc comments lazily, to match the compiler's behavior? again, I'm not an expert by any means, I just want to share my findings and thoughts, in case it was useful. |
…kril fix: Fix doc comment desugaring for proc-macros Fixes rust-lang/rust-analyzer#16259
rust-analyzer/xtask/src/flags.rs
Line 7 in 9b30521
compile_error!
argument must be a string" since #16158The text was updated successfully, but these errors were encountered: