-
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
serde_derive mod try; is seen as a syntax error by rust-analyzer 0.2.320 (2020-09-21). #6049
Comments
Rust-analyzer doesn't have much support for the 2015 edition. In the 2018 edition |
This is in serde_derive 1.0.104, it is using rust 2018? When I look at the serde_derive master here:
Is still there. Rolling back to rust-analyzer 0.2.313 solves the issue. I see https://doc.rust-lang.org/reference/keywords.html Question is that here rust-analyzer contradicts the cargo. Cargo builds on 1.46.0 rust with no problem. Rust-analyzer sees the issue. This is not my |
One more note on this. From the rust keywords page here: https://doc.rust-lang.org/reference/keywords.html#strict-keywords
Does it mean that serde_derive is ok with using |
Rustc in the 2018 edition gives:
|
serde_derive is still using the 2015 edition. There is no |
True. There is also a discussion about moving serde to 2018 edition. But looks like there is no milestone or plan for that, also based on serde compatibility back to Rust 1.13: Question is then if rust-analyzer will be enforcing rust 2018 keywords on non-2018 code. Serde_derive is an important library for many devs, I think. The change with Is here any way we can continue to use serde while using rust-analyzer? What would be the best possible solution? Anyway I can help? |
I guess I triggered that rust-analyzer journey into serde before (I thought with some cmd-hover over) and that caused an issue. But now after re-installing 0.2.320 again I can't reproduce the issue. Same file, same cmd-hover over and jumping into serde is not triggering the issue. All works as expected. Let me close this issue then. |
Actually the issue reappeared after a while, but as solution of enabling procmacro support works: #6054, keeping this as closed. |
Enabling proc macro support will make it support the two traits, but has no effect on any occurrences of |
I believe that I was not opening the serde code explicitly, but I certainly managed to reproduce the same action of mine unwillingly twice, so that rust-analyzer started to show that |
@lnicola It is reproducible with a blank project, adding the serde_derive line to Cargo.toml, and then adding As in the other issue, procMacro enabling fixes the issue in my usage, but I wanted to confirm that it does indeed cause an error without opening the serde source if procMacro is disabled. |
@ecton the "unresolved import" error is expected (and can be disabled by setting |
Is setting |
Yes, see #6054. It will turn off the "unresolved import" warnings, which can show up unexpectedly for types generated by a proc macro or build script, or when working on the compiler etc. It will also turn off the true positives ( |
I'm sorry @inicola for conflating the two issues. @staninprague I got here from a notification on #6054 and misunderstood the last few updates on this, leading me to demonstrate reproducing the issue from #6054, not the actual error mentioned in this thread. I'm not sure that my misunderstanding should be interpreted as more people running into this error. Apologies again for the confusion everyone. |
Thank you for the clarification! Looks like a fair deal to me. |
Thank for the excellent tool for the rust development!
After updating to rust-analyzer version 0.2.320 today, I'm seeing rust-analyzer complaining about unresolved import:
With error in serde_derive being at line:
try part is highlighted. Please see the screenshot attached.
Updating to 0.2.320 (2020-09-21) was the only change. Cargo build runs with no errors.

The text was updated successfully, but these errors were encountered: