-
Notifications
You must be signed in to change notification settings - Fork 511
Open
Description
I recently hit an issue generating the rust project file for rust analyzer. It was difficult to debug because the error was hidden by the parsing logic in gen_rust_project
. In this instance, the failure looked as follows:
$ bazel run @rules_rust//tools/rust_analyzer:gen_rust_project
INFO: Analyzed target @@rules_rust+//tools/rust_analyzer:gen_rust_project (208 packages loaded, 7813 targets configured).
INFO: Found 1 target...
Target @@rules_rust+//tools/rust_analyzer:gen_rust_project up-to-date:
bazel-bin/external/rules_rust+/tools/rust_analyzer/gen_rust_project
INFO: Elapsed time: 0.399s, Critical Path: 0.03s
INFO: 1 process: 378 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/rules_rust+/tools/rust_analyzer/gen_rust_project
Error: Failed to parse aquery output as JSON
After setting RUST_LOG=trace
I was able to rerun the exact same aquery command and find the actual error:
$ bazel --output_base=$output_dir aquery --include_aspects --include_artifacts --aspects=@@rules_rust+//rust:defs.bzl%rust_analyzer_aspect --output_groups=rust_analyzer_crate_spec "outputs(\".*\\.rust_analyzer_crate_spec\\.json\",deps(@//...))" --output=jsonproto
Starting local Bazel server (8.3.1) and connecting to it...
INFO: Analyzed 75 targets (389 packages loaded, 41655 targets configured).
INFO: Found 75 targets...
ERROR: Queries based on analysis results are not allowed if incrementality state is not being kept
INFO: Elapsed time: 14.385s, Critical Path: 0.00s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
While I'm still not sure what the cause is here, I think as a first thing it would be good to:
- Document the fact that
env_logger
is used by this binary and thatRUST_LOG
can be set to debug issues - Surface stdout and stderr from
aquery
when the command fails - Proactively check error codes when calling
aquery
I'll try to find time to open some of these fixes, but let me know what you all think. Thanks!
Metadata
Metadata
Assignees
Labels
No labels