-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
unresolved import for proc-macro generated identifier #6054
Comments
|
Also you can enable proc-macro support using {
"rust-analyzer.cargo.loadOutDirsFromCheck": true,
"rust-analyzer.procMacro.enable": true,
} |
This just started showing up for me when importing types from the |
I just started having this show up with @bjorn3's suggestion of enabling procMacro support worked for me to alleviate the issue. |
In the settings, add |
@Veetaha are you using nightly? |
Yes, I always do |
Oh, it looks like I need to rebase it. |
Could somebody tell a noob like me where this should go? I've just been working on a beginner project working with JSON files and my structs all have this proc macro unresolved import message. |
@suchapalaver which editor are you using? In Code, you can put it in And can you maybe share your code (or a reduced version) and compiler version? |
@lnicola, I'm using Emacs.
Here's some code:
The messages say |
@suchapalaver yeah, that should work, even in 1.54: Are you maybe using an older version of rust-analyzer? |
@lnicola , yeah, I was able to do quite a bit of updating, of rustc, my emacs packages related to LSP, and rust analyzer itself. Thanks for the lesson in keeping track of those. |
Hmm, do you have any rust-analyzer settings configured? Does it log anything and does the proc macro server start (you should see two rust-analyzer processes)? |
I don't have any rust-analyzer settings configured.
|
Summoning our emacs user, @flodiebold 😅. |
It works fine for me in Emacs as well. What do |
@flodiebold and @lnicola , I had to look up how to find "Look for lsp-mode variable to customize server path. Usually, you may find the variable by doing: M-x customize-group RET lsp-LANGUAGE-SERVER-ID", i.e. lsp-rust-analyzer. In those settings I found |
I'm getting this, not sure if it's related but when I search "rust-analyzer unresolved import on macro" this is where I'm sent. #[cfg(test)]
mod tests {
use test_case::test_case; Not breaking anything, but a little annoying. Tips? |
Why was this issue closed? It's still very much a problem. Also, setting |
@BrandonDyer64 because the root cause here (a change to the proc macro ABI) was fixed in #5651. It affected nightlies from the Rust 1.47. This was not the first proc macro interface change and it wasn't the last, but it makes no sense to track all of them in a single issue. If macros are not working for you, please file a new one, with more information (compiler version, test case, whether no macros work at all, or some of them do etc.). |
@lnicola The trouble is though, that my issue would be literally this issue. It's exactly the same problem. I have an attribute proc macro that goes over a function and generates a struct. The resulting struct is not seen by rust-analyzer and is shown as an unresolved import. |
It can't be the same problem unless you're using a post-1.46 toolchain with a two year-old rust-analyzer (in which case you should upgrade). So you should provide the info I mentioned before. |
Just realized I'm stuck on rustc 1.45, so never mind I guess |
In our project we have a bunch of types generated from proc-macros. Recently (probably since #6016) all such imports are flagged as unresolved import. That seems to be an expected consequence. Is there any way to disable such errors, as it makes it vastly harder to see real errors from Rust Analyzer.
The text was updated successfully, but these errors were encountered: