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 module rust-analyzer error. #5484
Comments
Which VSCode version are you using? |
The latest version at the time of this post. 1.47.2. |
I'm seeing this too, closing and re-opening the |
I've been trying to figure out what's going on for the last couple of days to no avail. I've removed projects one-by-one from my workspace, removed the circular dev-dependencies, turned off all features, turned on all features, turned off proc-macro expansion, etc. I also enabled trace server logging, but nothing stood out to me. No error messages coming from the server at all. When I tried building from source (to see if maybe the bug had been fixed), I ran into #5556. Could the two issues be related? The weird syntax errors happen to correlate with the modules I've been having problems with: I'm happy to help give more information in any way I can. This bug is making RA unusable ATM :(. I'm having to gasp use RLS just to get some code-completion. |
I'm seeing the same issue, VS Code 1.47.3, rust-analyzer 0.2.256. |
@RamiHg is your project public so we could try to reproduce this? If not, could you try to minimize it (e.g. by removing modules, types, replacing function bodies with |
The smallest reproducible example I have is attached. To reproduce:
Should see: It seems to be fine if |
If I close and reopen the file, the error is not shown until I edit it. The error is shown before save. If I close all files, close VS Code, reopen VS Code, reopen Closing but if I edit the file, then it goes back to the first screenshot, with an error for |
Also, if I delete the |
@DouglasLivingstone that looks like exactly the same steps + weird behavior that I encountered! @lnicola: I should mention that this was only happening on Windows. I could not reproduce the bug on either Mac OS or Linux. If you can't reproduce the bug with @DouglasLivingstone's use-case, I'll just make my repo public. |
I can also confirm this behavior. |
I had the same problem with a nested library package. After starting up VSCode and editing the I tracked the problem down to a path normalization problem related to Vfs / FileSets. In my system, some paths enter the rust-analyzer with lowercase drive letters (in this case Edit: I've isolated the problem to the VfsPath::encode function: f0d511e |
This bug replicated for me as of 1/3/2024. I fixed it simply by closing and reopening VSC. |
Hello,
Ever since the latest update, I've been getting strange "unresolved module rust-analyzer" errors on lines that define modules. E.g.:
The problem occurs in only one library in my workspace. A seemingly random subset of 1-9 module defines have that error. Every time I restart VSCode, a slightly different subset of those 1-9 have that error. If a module has that error, rust-analyzer does not work for that module (no autocomplete, hints, etc).
There are no errors in the Rust Analyzer Language Trace, except for
[ERROR ra_project_model] cyclic dependency <unrelated module> -> <unrelated module>
. But that error has been there for months, and I suspect it's a separate issue (they are both dev-dependencies of one another).I am however seeing errors in the "Extension Host" log. I've attached the full log (ra_errors.txt) with the callstack, but here are some of the error messages:
Windows 10, rustc 1.45, rust-analyzer v0.2.248.
The text was updated successfully, but these errors were encountered: