bazelbuild / bazelbuild/rules_rust
Implement a 'check' target for 'rust_binary' and 'rust_library'.
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
I'd be nice to support a target similar to 'cargo check' entirely inside bazel.
### **Idea:**
By running ```rustc --error-format=json -Z no-codegen``` we get an output expected by rust analyzer. With some clever code generation It could allow the user to set ```checkOnSave.overrideCommand``` in the rust-project.json to run this target, generating necessary info for rust-analyzer to get proper error highlighting.
### **Details:**
For each generated binary/library/crate, generate a `_check` target. When running this target, we execute appropriate ```rustc --error-format=json -Z no-codegen```, returning the errors, warnings in json fomat.
Then, when generating `rust-project.json` for rust-analyzer, insert `"checkOnSave.overrideCommand" : "bazel run _check"`
Contributor guide
Assessment
This issue has not been assessed yet.