Tolerate partial build failures during rust-analyzer discovery#4127
Merged
UebelAndre merged 1 commit intoJul 3, 2026
Merged
Conversation
`discover_bazel_rust_project` builds the rust-analyzer aspect over the whole workspace and bailed on any non-zero Bazel exit. In a large monorepo a single broken target (e.g. an unrelated, unmaintained one) aborted the build, leaving rust-analyzer with no Bazel project model. It then silently falls back to a Cargo workspace, which breaks proc-macro expansion (toolchain ABI mismatch) and materializes a stray `target/`. Pass `--keep_going` so Bazel keeps building the rest of the graph, and treat the result as usable when the BEP still yielded crate specs: proceed with a `log::warn` that the project may be incomplete, and only fail when zero specs were produced. This mirrors `flycheck`'s existing exit-code handling. Add an end-to-end test that stands up a workspace with one good `rust_library` and one target that fails analysis, then checks discovery still returns a project containing the good crate. Unit tests cover the `assess_discovery` decision.
UebelAndre
approved these changes
Jul 3, 2026
UebelAndre
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! Seems reasonable to me 😄
Contributor
Author
|
Thanks a lot, and thanks for your great changes to make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
discover_bazel_rust_projectbuilds the rust-analyzer aspect over the whole workspace and bailed on any non-zero Bazel exit. In a large monorepo a single broken target (e.g. an unrelated, unmaintained one) aborted the build, leaving rust-analyzer with no Bazel project model. It then silently falls back to a Cargo workspace, which breaks proc-macro expansion (toolchain ABI mismatch) and materializes a straytarget/.Pass
--keep_goingso Bazel keeps building the rest of the graph, and treat the result as usable when the BEP still yielded crate specs: proceed with alog::warnthat the project may be incomplete, and only fail when zero specs were produced. This mirrorsflycheck's existing exit-code handling.Add an end-to-end test that stands up a workspace with one good
rust_libraryand one target that fails analysis, then checks discovery still returns a project containing the good crate. Unit tests cover theassess_discoverydecision.Written with Claude, but I believe I understand what is going on.