rust-analyzer: Rust analyzer fails to load workspace
I tried to find solutions on the stackoverflow and other similar issues in this list but none of the solutions seemed to work for me. I’m a rust noob and I’ve installed rust-analyzer in vscode. On mostly every “get started” video on youtube RA seems to work out of the books but I get this error message:
rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/remax/Storage/Projects/rust/rusttest/Cargo.toml, cargo 1.61.0 (a028ae4 2022-04-29): Failed to run
"/home/remax/.cargo/bin/cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/remax/Storage/Projects/rust/rusttest/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu":cargo metadataexited with an error: error: could not execute processrustc -vV(never executed) Caused by: No such file or directory (os error 2)
In my workspace I only have a rust project folder created by running: cargo new projectname.
rustc --version outputs this rustc 1.61.0 (fe5b13d68 2022-05-18) cargo --version outputs this cargo 1.61.0 (a028ae4 2022-04-29)
which rustc --> ~/.cargo/bin/rustc which cargo --> ~/.cargo/bin/cargo
To be honest I’m getting really desperate here. Can’t get this to work for a couple of days now.
Cargo.toml contains this:
[package]
name = "rusttest"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
I am well aware that this is one of the most common issues with beginners and that fixes are usually simple so don’t hold it against me for repeating a question. Thanks in advance for your help.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (10 by maintainers)
@toddewilliams you might want to follow https://github.com/rust-lang/rust-analyzer/issues/11080.