-
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
No error shown when running cargo metadata
on the sysroot fails
#19281
Comments
You're supposed to fill these in, but you probably have an old toolchain. Only 1.82 and newer are supported at the moment. |
Hi Sorry, I just filled it in now. I have version 1.85.0 |
Do you have |
I have rust-src installed: PS C:\Users\Alan\Rust-Project> rustup component list There are no errors on the status bar. |
What do you get for "rust-analyzer: Status"? |
When I run it rust-analyzer: Status via the command palette I get this huge json file:
|
Sounds like it's working fine. Does it show |
Yes, it shows unknown for strings. Vec for vec of strings. It even shows unknown for hardcoded type. e.g let my_string: String = format!("Hello {}", "world"); I'm unable to go to string definition either. |
Maybe your toolchain got corrupted? Try |
Uninstalling and reinstalling rust-analyzer and rustup via https://www.rust-lang.org/tools/install did not work, as in it still shows types as unknown. I had faced this issue before on a previous new install. I did see an issue on here which advised on downloading a pack, that solved my problem at the time, but I can't find the issue it was written on now. |
#18560 (comment) . I've mentioned the same problem before, but using 1.81.0 all the time is fine. After updating the ruat-analyzer extension in VSCODE today, 1.18.0 also mentions { unknow } , which I found only for prelude pre-imported modules. I'm not sure if it has anything to do with the image source cargo has set up, but the company's internal network only synced crates up to 2024-08-01. |
Finally managed to get it to work. The Solution was to include at $CARGO_HOME/config.toml; the config.toml should include your source and registry configuration (However you usually get through to the internet through the firewall.) I got to the solution by attempting to run cargo metadata "~/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/library" , Which failed with spurious network connection as the error message. That gave me the hint. Thank you @ByteXiang your suggestion pointed me to the right direction. #17759 Thank you @lnicola for your effort and help. |
So we don't show an error on |
Yup, the error only appears after going to -> cd $(rustc --print sysroot)/lib/rustlib/src/rust/library && __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS=nightly And then running -> cargo metadata |
cargo metadata
on the sysroot fails
rust-analyzer version:
0.4.2329
rustc version: 1.85.0
editor or extension: VSCode
relevant settings: Fresh VSCode and Rust-Analyzer installation
code snippet to reproduce:
// add your code here
The text was updated successfully, but these errors were encountered: