rust-analyzer: Regression in v0.2.686: `OUT_DIR` not set, enable "run build scripts" to fix
Repro: https://github.com/shikhar/bazel-tonic/tree/4a27fbf7fe15a26804a3eb5eb3f7b62dafa9fba4

The error does not make sense because that setting defaults to true.
The error is gone after after rolling back to the last release v0.2.678.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 14
- Comments: 29 (6 by maintainers)
Same as @asaaki & @trentbb: discovered this when using bindgen in a workspace member crate. Made a reproduction repo with a minimal bindgen
rust-analyzer --version:rust-analyzer 516eb40ba 2021-09-13 stableOS: Arch Linux x86_64 (5.14.2) Editor: Neovim 0.5Reopening as folks are running into it, although I am not currently experiencing this problem.
ED: also running into this!
I have seen this issue right now myself, currently running RA nightly / 0.3.708 (VSC 1.59.0, Win10). Have not a repro repo, but I have a suspicion: The error happens when I work in a VSCode workspace with multiple folders/projects, but it does not happen when I open the project individually.
From a freshly generated one using tonic. Interestingly, it works perfectly fine on windows, but not on ubuntu (over VsCode SSH)
The project is basically their hello-world example
had the same effect on single-project workspace after deleting and rewriting build.rs restarting vs code did solve.
Same as @asaaki I am seeing this error when I have my whole workspace open. Opening up the individual project fixes the issue.
Hmm, I can’t reproduce this problem on another machine, so closing
Restarting the VS code fixed the issue for me
I’m facing the same issue in neovim with rust-tools.nvim in default config.
UPDATE: I’m using one
include!(concat!(env!("OUT_DIR"), ""))fortonic_buildgenerated sources and another for sources generated from a custom binary.rust-analyzer versions tested:
OUT_DIR not set, enable "run build scripts" to fix)OUT_DIR not set, enable "run build scripts" to fix)proc macro server crashed)Versions in use:
If anyone is using Emacs with
lsp-mode, a simpleM-x lsp-workspace-restartseemed to do the trick.Hi,
in my case the solution was install protobuf in my local machine, I use Mac so I ran “brew install protobuf” after that I was complete the project and the error is done.
You can use
"rust-analyzer.diagnostics.disabled": ["macro-error"]to disable presentation of the error. Which project do you get this error on by the way?Also seeing this error when having my whole workspace open with multiple crates. Has anyone figured out a solution?
You can follow the instructions here: https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/dev#launching-rust-analyzer
Can you post the configuration picked up by the extension? It should be printed to the “Output” tab under “Rust Analyzer Client”.