-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Attribute proc-macro expansion issue #10498
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Can you provide the crate where the macro comes from and ideally some example code? The problem is likely that the proc macro emits an error when the function is syntactically invalid. (What error message does rustc emit when faced with this incomplete code?) In that case, probably your only options are to either report this to the proc macro authors and wait for them to fix it, or to disable attribute macro expansion again. |
The crate is |
Like @Veykril said, the crate is
Please see the screenshot for the error message. Yes it is complaining about invalid syntax, but that's not very helpful in identifying the root cause. |
Hm. The first error comes from rustc's parser; does the second one come from the macro? If so, how does rustc know the location? Does rustc even try to expand the macro if there's a syntax error in the input? 🤔 |
Ah, Edit: But actually, with a test proc macro it seems to be working fine 🤔 |
+1 on this. I also happens with the |
Tracing: tokio-rs/tracing#1633 |
Beautiful, thank you for the hard work everyone ❤️ |
So this is an issue of the specific proc macro implementation, right? So if I notice it with any other macros (like in actix or async-graphql...), I should prefer reporting it to them? |
If it's the same issue, you could, e.g. actix/actix-web#2394. |
I'm having the same issue with the async-trait macros, should I report it there? |
Yep, that should have the problem as well, https://github.com/dtolnay/async-trait/blob/70bdfa4a8035393164a79391fdb862acc3310c66/src/lib.rs#L334-L335, so reporting that issue there would be a good idea. |
Closing in favor of #11014 |
Commit 81891f7 enabled attribute proc macro by default (released in v0.2.768). That rendered rust-analyzer unusable in my case. Basically whenever I change something, the whole function is marked as problematic. Please see the two screenshots for comparison.
First screenshot shows the result when that option is enabled; second screenshot shows the result when the option is disabled.
In the second screenshot, rust-analyzer correctly points out that
let x
is problematic.The text was updated successfully, but these errors were encountered: