6

I'm going through the rustlings exercises, and noticed that rust-analyzer was on but was not generating any inline error messages or type hints. Basically not doing anything at all.

I thought this was because I didn't open the top-level rustlings dir with the cargo.toml in it, so I closed VSCode, then opened that dir as my workspace in VSCode, and made sure the workspace was set as "trusted". Still, nothing from rust-analyzer.

In comparison, I created my own cargo package using cargo new, then opened it in VSCode, and rust-analyzer worked fine, with errors and type hints and everything.

Why rust-analyzer won't work for rustlings workspace?

VSCode 1.74.3 Debian 11 Rustlings cloned Jan 2023

xdavidliu
  • 2,411
  • 14
  • 33

1 Answers1

5

It's because rustlings has a strange directory structure with exercises in a separate dir from src (or something like that). See this similar thread on rust forums.

This issue can be solved by doing rustlings lsp, after which rust-analyzer will work.

xdavidliu
  • 2,411
  • 14
  • 33