Skip to content

incompatible_do_not_include_transitive_data_in_compile_inputs #3915

@UebelAndre

Description

@UebelAndre

Summary

Transitive data dependencies are currently included in the compile inputs of Rustc actions via dep_info.transitive_data in _process_build_scripts. This means that changes to a data file in a dependency trigger recompilation of all downstream targets, even though data files are intended to be runtime-only dependencies (unlike compile_data).

For example, if library bar has data = ["foo.txt"], editing foo.txt does not rebuild bar itself, but does rebuild any binary that depends on bar. This is incorrect -- only compile_data should affect compilation, while data should only affect runfiles.

See #3609 for the original bug report and reproduction case.

Change

A new incompatible flag incompatible_do_not_include_transitive_data_in_compile_inputs has been introduced (defaulting to True) that removes dep_info.transitive_data from the compile inputs constructed in _process_build_scripts.

This is safe because:

  • Proc macro data is already handled separately via dep_info.transitive_proc_macro_data in nolinkstamp_compile_inputs
  • Direct build script compile data (build_info.compile_data) is already added independently
  • The transitive_data field on DepInfo continues to serve its purpose in collect_deps for propagating data to proc macros

Migration

If you rely on the old behavior where data files from transitive dependencies are available as compile inputs, you can opt out by setting:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions