#Rust analyzer error, cannot read metadata from Cargo.toml

1 messages · Page 1 of 1 (latest)

silver current
#
[ERROR rust_analyzer::reload] failed to switch workspaces: rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/supreetsingh/Documents/SavedPrograms/Rust/remind-me/Cargo.toml, cargo 1.57.0-nightly (7fbbf4e8f 2021-10-19): Failed to run `cargo metadata --manifest-path /home/supreetsingh/Documents/SavedPrograms/Rust/remind-me/Cargo.toml`: `cargo metadata` exited with an error: Updating crates.io index error: failed to select a version for the requirement `phf = "^0.11"` candidate versions found which didn't match: 0.10.1, 0.10.0, 0.9.0, ... location searched: crates.io index required by package `tokio-postgres v0.7.7` ... which satisfies dependency `tokio-postgres = "^0.7.7"` (locked to 0.7.7) of package `postgres v0.19.4` ... which satisfies dependency `postgres = "^0.19.4"` (locked to 0.19.4) of package `remind-me v0.1.0 (/home/supreetsingh/Documents/SavedPrograms/Rust/remind-me)

So this problem is just arising in one rust project of mine. Cargo is in the path and this problem arose when I added one new dependency to my project and now I am stuck with this.
I have tried looking for the answer on the internet and did not find success yet, I do not know what else to try next.

cargo metadata --manifest-path <path to the file>
Works in the console I do not know why is this not working right now.

I am running this on Manjaro and my text editor is Vim with YouCompleteMe being used for AutoComplete.

celest shell
#

Can you show what your Cargo.toml looks like?

#

It looks like the package it's complaining about, phf, does indeed have a 0.11 version, so from the Googling I just did it could be a corrupt cache or something. You can try rm -r ~/.cargo/registry ~/.cargo/.package-cache to clear your cache and force it to re-update the entire index. 🤔

#

I don't think that should have any adverse effects

zealous nacelle
#

Yeah afaik you can safely delete the stuff in the registry

#

Maybe not the registry folder itself tho

celest shell
#

I saw a stackoverflow post that suggested just deleting all of ~/.cargo, and it was accepted so I think it'd be fine