esp-rs / esp-idf-template

A "Hello, world!" template of a Rust binary crate for the ESP-IDF framework.
373 stars 44 forks source link

Rust-analyzer errors when opening a project generated with the cargo template #74

Closed JohnTheCoolingFan closed 1 year ago

JohnTheCoolingFan commented 1 year ago

Rust-analyzer generates this error when opening a project:

LSP[rust_analyzer] rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/jtcf/rustworks/esp-test/Cargo.toml, Some(Version { major: 1, minor: 66, patch: 0 }): Fail
ed to run `"cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/jtcf/rustworks/esp-test/Cargo.toml" "--filter-platform" "xtensa-esp32-espidf"`: `cargo metadata` exited with an error: error: f
ailed to run `rustc` to learn about target-specific information                                                                                                                                              
Caused by:                                                                                                                                                                                                   
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --cfg espidf_time64 --target xtensa-esp32-espidf --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib -
-crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)                                                                                                                  
  --- stderr                                                                                                                                                                                                 
  error: Error loading target specification: Could not find specification for target "xtensa-esp32-espidf". Run `rustc --print target-list` for a list of built-in targets

This is in neovim

MabezDev commented 1 year ago

RA uses the normal toolchain by default which is why this error is happening. You need to configure RA to use the esp toolchain instead.