bazelbuild / bazelbuild/rules_rust
`CrateInfo.data` does not contain transitive data
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
First, this description is wrong:
https://github.com/bazelbuild/rules_rust/blob/f5b713578a97eca01c449dc211a801c48f2c5ee3/rust/private/providers.bzl#L27
The `CrateInfo.data` field is the data attribute of the target ([`rust_binary`](https://github.com/bazelbuild/rules_rust/blob/f5b713578a97eca01c449dc211a801c48f2c5ee3/rust/private/rust.bzl#L307), [`rust_library`](https://github.com/bazelbuild/rules_rust/blob/f5b713578a97eca01c449dc211a801c48f2c5ee3/rust/private/rust.bzl#L243)).
With that clarification, is there a reason this depset doesn't include all transitive data? This becomes an issue in the following case:
```python
rust_library(
name = "foo",
srcs = ["foo.rs"],
data = ["foo.txt"],
)
rust_library(
name = "bar",
srcs = ["bar.rs"],
deps = [":foo"],
)
```
When operating on the `CrateInfo.data` provider from `bar`, it will not include `foo.txt` from the `:foo` dependency which seems unexpected. My initial thought was to collect all `CrateInfo.data` members into each crate such that `:bar` would now include that file. But if there is value for folks already having `data` be representative of just that target, then perhaps it'd be sensivle to have a `CrateInfo.transitive_data`?
For the record, it seems `DefaultInfo.default_runfiles` is constructed according to my expectations mentioned above.
Contributor guide
Assessment
This issue has not been assessed yet.