Rust-analyzer "Failed to read Cargo metadata" with no explanation (rust-toolchain file)

Hello,

I'm trying to run rust-analyzer on https://github.com/dalek-cryptography/bulletproofs . It just won't work even tho doing cargo metadata works on that same project.

I noticed that rust-analyzer is trying to use an old cargo version, so I removed it but then I noticed that rust analyzer tries to install it on its own...

This doesn't happen on other projects.

❯ rust-analyzer analysis-stats .
Failed to create perf counter: Operation not permitted (os error 1)
[ERROR rust_analyzer] Unexpected error: Failed to read Cargo metadata from Cargo.toml file /home/user/bulletproofs/./Cargo.toml, cargo 1.38.0-nightly (d0f828419 2019-07-23)
Failed to read Cargo metadata from Cargo.toml file /home/user/bulletproofs/./Cargo.toml, cargo 1.38.0-nightly (d0f828419 2019-07-23)
❯ rust-analyzer --version
rust-analyzer 04f03a360 2021-11-02 dev

Thanks a lot!

Repository contains a rust-toolchain file at the root, and rust-analyzer is probably trying to respect it. If you delete this file, would the repo compile?

1 Like

Oh man. That was it.... I didn't know this interaction with rust-toolchain.

Thanks a lot!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.