Why do rustc-generated dep-info files include themselves?


If you ask rustc to --emit dep-info, the resulting dependency file contains a rule for producing the dependency file itself. This differs from the output of gcc -MD or clang -MD, which only includes dependency rules for the object files produced.

Tools like Ninja often consume and delete dependency files as soon as they’re produced. Once deleted, though, the now-missing dependency file causes the tool to immediately think a rebuild is necessary.

Is this behavior intentional, or should we make rustc --emit dep-info behave more like gcc -MD or clang -MD?