Rust-analyzer not working

I cannot get rust-analyzer to work in VS Code
I get the following error

rust analyzer failed to run build scripts:
error: could not compile 'sqlx-rt' due to 2 previous errors

No idea of what errors the message is talking about. There are no code to run or anything. I want linting and syntax highlighting

Does running cargo build in the project directory work?

Yes cargo build and cargo run works but when writing code I get no assistance from rust-analyzer

I wonder if this could perhaps be caused by "Check on save: All Targets", being enabled.
However it sounds like that would just be check rather than a build failure, but might be worth trying to disable that and also passing --all-targets on the command line to see if that causes it to fail there?

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.