4

Got this error with rust-analyzer VS Code, although cargo build builds the project without errors or warnings.

rustc version: 1.54.0

I would like to stay on the "stable" rustc version and not shift to "nightly".

Thorkil Værge
  • 2,727
  • 5
  • 32
  • 48

1 Answers1

7

Update rustc to fix this and ensure that Visual Studio Code uses the correct Rust compiler.

  1. Run rustup update to update rustc
  2. Check version used by rust-analyzer: Ensure that ctrl+p -> Rust Analyzer: Show RA Version shows rust-analyzer version: 183ef048f 2021-11-22 stable, or later.
  3. Run cargo clean to clear obsoleted compiler output
  4. Close all VS Code windows and open them again.

This should fix the issue. If not, have a look here.

Thorkil Værge
  • 2,727
  • 5
  • 32
  • 48