0

rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.tml file /home/eth/Downloads/testing/Cargo.toml, cargo 1.33.0-nightly (0d1f1bbea 2018-12-19): Failed to run '"cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/eth/Downloads/testing/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"': 'cargo metadata' exited with an error: error: Found argument '--filter-platform' which wasn't expected, or isn't valid in this context

I needed to reinstall my OS few days back, and when I installed and configured my plugins in NeoVim - CoC is being used for code suggestion -, that error came out. I believe that's not a NeoVim/CoC problem, that's why I tagged it so. I don't have much experience dealing with that kinda stuff, so I don't even know what else information I could provide...

Duet Dusha
  • 11
  • 1
  • 2
  • 2
    [Please do not upload images of code/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Jmb Jan 17 '22 at 10:26
  • `cargo 1.33.0-nightly` seems to be quite old. How did you installed Rust? – Cerberus Jan 17 '22 at 11:22
  • I needed to install that version because of compatibility issues and change it into the default or something like that, but I'm quite sure there are more recent versions that could do the job. – Duet Dusha Jan 17 '22 at 11:30
  • 1
    The latest cargo version is 1.58.0. Did you install Rust with rustup? Update Rust, it should solve the problem. – Chayim Friedman Jan 17 '22 at 11:35

1 Answers1

2

Update Rust.

rust-analyzer invokes the command cargo metadata with the flag --filter-platform. This flag was added in Rust 1.41.0. Since you're using an older Rust version (1.33.0), Cargo complains.

Chayim Friedman
  • 47,971
  • 5
  • 48
  • 77