bazelbuild / bazelbuild/rules_rust
Make complete bazel_env development setup possible
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
[bazel_env](https://github.com/buildbuddy-io/bazel_env.bzl) aims to provision all needed dev tools from Bazel Toolchains.
There is already an example of how to use it with `rules_rust` in [examples/bazel_env](https://github.com/bazelbuild/rules_rust/tree/main/examples/bazel_env).
This setup is already usable but some ["rust components"](https://rust-lang.github.io/rustup/concepts/components.html) are missing. These pieces are special in so far they are "only" needed for development and not for a Bazel build:
* `rust-src`: The sources for the standard library.
* `rust-analyzer`: Maybe rust_analyzer (even though visual code seems to have downloaded it on its own, other IDEs might vary)
Example complaint from the "Visual Code Rust Analyzer" extension:
```
Workspace `/home/peter/nexxiot/nx0/Cargo.toml` has sysroot errors: can't load standard library from sysroot
/home/peter/.cache/bazel/_bazel_peter/c3168268db16f5d2c086cccc078019b4/external/rules_rust~~rust~rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools
(discovered via `rustc --print sysroot`)
try installing the Rust source the same way you installed rustc
```
One could special case these components or provide a general mechanism to specify which components to include.
There is already one "components-themed" arguement in [rust_register_toolchains](https://bazelbuild.github.io/rules_rust/flatten.html#rust_register_toolchains), maybe we could add an additional one like `additional_components`?
Contributor guide
Assessment
This issue has not been assessed yet.