Description
I'm using the Bazel build system. The rules_rust
project (https://github.com/bazelbuild/rules_rust) adds build rules to Bazel that allow generation of a rust-project.json
file to support usage of rust-analyzer
with a Non-Cargo Based Project (https://rust-analyzer.github.io/book/non_cargo_based_projects.html). This looks something like:
{
"sysroot": "/private/var/tmp/_bazel_cameron/f5a6fe93ded5fb771eddb255ace4ff75/external/rules_rust++rust+rust_analyzer_1.88.0_tools",
"sysroot_src": "/private/var/tmp/_bazel_cameron/f5a6fe93ded5fb771eddb255ace4ff75/external/rules_rust++rust+rust_analyzer_1.88.0_tools/lib/rustlib/src/library",
"crates": [...]
}
As of a recent release, this causes rust-analyzer to repeatedly generate a lockfile (target/rust-analyzer-metadata/sysroot/Cargo.lock
) in the project root directory. It'd be nice to not have this happen, given that we're not using Cargo to begin with, and I'd prefer to not pollute my project directory vs e.g. having to add this path to gitignore.
rust-analyzer version: 2025-06-23
rustc version: 1.88
editor or extension: Zed
relevant settings: ^
code snippet to reproduce: see the config above