Skip to content

Leftover rust-analyzer specs can cause generation to fail #2774

Open
@UebelAndre

Description

@UebelAndre

I ran into a odd situation where after running bazel run @rules_rust//tools/rust_analyzer:gen_rust_project I got an error

Error: Failed to make progress on building crate dependency graph

However, I was confused because on a different machine (same code and commit) the tool worked just fine. After running

RUST_LOG=debug bazel run @rules_rust//tools/rust_analyzer:gen_rust_projec

and diffing logs from the working machine and broken machine, I noticed the working machine had

[WARN gen_rust_project_lib::aquery] Skipping missing crate_spec file: ....

but the broken machine didn't have this log and instead had

[DEBUG gen_rust_project_lib::aquery]  CrateSpec {crate_id: "ID-external/....." }

This lead me to the following code which suggests that any leftover outputs from other configurations might impact generating rust-project.json and lead to the failure above

if path.exists() {
output_files.push(path);
} else {
log::warn!("Skipping missing crate_spec file: {:?}", path);
}

The "solution" was to run bazel clean and retry generating rust-project.json. This solution is not acceptable to me and should be considered a big. The tool should behave consistently even if there's some leftover files in bazel-out/.

I don't yet have a consistent repro but hoping someone else does 😅. Either way, thought this info would be useful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions