Skip to content

CrateInfo.data does not contain transitive data #3902

@UebelAndre

Description

@UebelAndre

First, this description is wrong:

"data": "depset[File]: Compile data required by crates that use the current crate as a proc-macro.",

The CrateInfo.data field is the data attribute of the target (rust_binary, rust_library).

With that clarification, is there a reason this depset doesn't include all transitive data? This becomes an issue in the following case:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageThe ticket needs maintainer attention.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions