-
Notifications
You must be signed in to change notification settings - Fork 1.7k
rust-analyzer failed to load workspace #4172
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
Comments
|
Isn't that https://github.com/rust-lang/rustup#can-rustup-download-the-rust-source-code |
|
Hey,
|
What is the output of
|
it seems like I only have the path up to lib/rustlib I don't have src/rust/src, should I reinstall stuff? What I have in rustlib is
|
Quick update, I uninstalled all of the rust toolchain, and then reinstalled and the issue has gone away |
Closing the issue, as it seems to be the problem with local toolchain installation. it would be awesome if we could diagnose and warn about this on our side, but I doubt we can provide info more useful then the existing error message. |
I have the same issue with nightly-x86_64-unknown-linux-gnu (1.48.0-nightly) on ubintu linux and vs code. I have completely uninstalled rust and reinstalled, but I get
running it looks like I am missing the
I should add that this is a VS code remote session, maybe this complicates things? |
Try |
Thanks for your reply, this produces the following result:
|
I am able to reproduce this with Mac OS 10.15.6 and 1.48.0-nightly as well:
I also ran |
Lastly, this should be fixed if you take recent version from master: |
This should have been fixed in #5586. |
Thanks @lnicola I feel that maybe the official extension isn't picking up that change yet, which causes the breakage, even though everything should work by now. That's why I build and install from source. |
I still have the same issue with MacOS 10.15.6, 1.48.0-nightly even I build and install from source. There's only
|
I believe at this stage its just a matter of verifying that you actually use rust-analyzer from source (first uninstall from your VSCode, then install) |
My rust environment is not working, so I decided to uninstall and reinstall entire rust system. Emacs version 27.1(9.0) Here's what I did.
Emacs lsp says
There's no src directory. |
It's not working for me too. |
Just running |
I'm having the same problem too on Arch Linux. Maybe the I think the path for me is |
@LU15W1R7H the path changed only once (recently), and while |
I got same problem on Arch Linux. Here is the error log in Emacs buffer
I create a test project using command Did uninstall & reinstall nightly toolchain, and here is the output of command:
And I execute command:
I have following setting in export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src" |
@stardiviner try to unset RUST_SRC_PATH and check what |
@lnicola After unset |
That's strange, recent versions print a " Anyway, is it working now? I think |
Still not work.
I'm sure I installed |
I don't have
Same error. |
@kushaldas Can you provide more info about your system and editor etc? and try to get env variable info from editor. |
If you're using Spacemacs, it has this thing where it saves the environment in a file and reproduces it from there (see ~/.spacemacs.env). Or if you're not, maybe there's something similar going on. We're ignoring RUST_SRC_PATH now if it doesn't contain core though, so it shouldn't matter much anymore.
Please post the exact error message you're getting, and the output from |
I am using neovim and coc-rust-analyzer. After fighting for the whole day, I removed all rust* from the system, and did a fresh install. Now everything is again working. Thank you for the help. |
How did you install rust? I'm just experiencing the same issue now |
I encountered this problem when using rust in a custom alpine docker image. The following solved it. RUN sudo apk del cargo rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
I want to use rust-toolchain
I have tried
but rust-analyzer shows me the same error. |
@soraiemame the sysroot ( |
Thank you for responding. I did not know that. I will use the stable toolchain for now then. |
In Windows system I try to install below and resolved: scoop install rustup |
For anyone jumping to the end of this thread, the solution for me (mentioned here) was:
|
for /etc/profile or ~/.zshrc or ~/.bashrc not working for me. ls $(rustc --print sysroot)/lib/rustlib/src/rust/src |
Same issues, just run |
@pluveto which Rust version are you on? |
latest nightly when I post. finally I reinstalled my os and fixed it. this may be a issue with some other software |
After trying various things up above, I uninstalled and reinstalled vscode which fixed the problem for me. |
I ran into this problem installing rust_analyser. After that, the rust_analyser error disappeared and clippy kicked into action. |
it works after running |
I have sloved this problem after I copy the folder (nightly-x86_64-pc-windows-msvc and nightly-2020-05-10-x86_64-pc-windows-msvc both are in the sysroot folder). The reason of the problem is the version error of rustup, as above, it can't identified the old version toolchains' folder path layout. |
+1 |
I had this problem on Arch Linux too, and solved it with |
On manjaro linux I was able to resolve this by using the |
Yes its work like a charm. |
This is a bit off-topic but in case you're using offline installer where Check release date and version from this page (latest release only). Example link for v1.71.0: EDIT: Can also be seen here. Download the toml file that you want and search for "rust-src.target" |
|
For anyone who might be experiencing "the workspace is missing a sysroot" issue, the solution mentioned above worked perfectly. |
I installed rust with
brew
on MacOS, and I'm noticing this error on a hello world project with VS Code:I didn't install with rustup, and I figured I wouldn't need to. This suggests I must, but why? Does this suggest I need the complier source to use your package in my editor?
The text was updated successfully, but these errors were encountered: