Rust-Analyzer failed to load workspace, failing because of dependencies

Viewed 40
[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.

If someone can point out what is wrong with the dependencies, I would be very thankful.

Thanks.

1 Answers

phf 0.11 requires Rust 1.60. You need to either update your Rust compiler to at least that version, or follow the chain of dependencies and downgrade the postgres crate so that you don't require phf 0.11.

Related