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:
Summary
Transitive
datadependencies are currently included in the compile inputs of Rustc actions viadep_info.transitive_datain_process_build_scripts. This means that changes to adatafile in a dependency trigger recompilation of all downstream targets, even thoughdatafiles are intended to be runtime-only dependencies (unlikecompile_data).For example, if library
barhasdata = ["foo.txt"], editingfoo.txtdoes not rebuildbaritself, but does rebuild any binary that depends onbar. This is incorrect -- onlycompile_datashould affect compilation, whiledatashould 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_inputshas been introduced (defaulting toTrue) that removesdep_info.transitive_datafrom the compile inputs constructed in_process_build_scripts.This is safe because:
dep_info.transitive_proc_macro_datainnolinkstamp_compile_inputsbuild_info.compile_data) is already added independentlytransitive_datafield onDepInfocontinues to serve its purpose incollect_depsfor propagating data to proc macrosMigration
If you rely on the old behavior where
datafiles from transitive dependencies are available as compile inputs, you can opt out by setting: