Skip to content

depfile generated by rustc includes contains the depfile itself #66006

Description

@petrhosek

rustc generates depfiles that have the following shape:

host_x64/exe.unstripped/cmc: ../../src/sys/cmc/src/main.rs ../../src/sys/cmc/src/cml.rs ../../src/sys/cmc/src/compile.rs ../../src/sys/cmc/src/format.rs ../../src/sys/cmc/src/merge.rs ../../src/sys/cmc/src/opts.rs ../../src/sys/cmc/src/validate.rs

host_x64/exe.unstripped/cmc.d: ../../src/sys/cmc/src/main.rs ../../src/sys/cmc/src/cml.rs ../../src/sys/cmc/src/compile.rs ../../src/sys/cmc/src/format.rs ../../src/sys/cmc/src/merge.rs ../../src/sys/cmc/src/opts.rs ../../src/sys/cmc/src/validate.rs

../../src/sys/cmc/src/main.rs:
../../src/sys/cmc/src/cml.rs:
../../src/sys/cmc/src/compile.rs:
../../src/sys/cmc/src/format.rs:
../../src/sys/cmc/src/merge.rs:
../../src/sys/cmc/src/opts.rs:
../../src/sys/cmc/src/validate.rs:

When invoking rustc from Ninja, it causes Ninja to rebuild the target on every invocation: Ninja consumes and deletes the cmc.d depfile (unless -d keepdepfile is specified) and process its content, recording cmc.d as an additional output of the rule that produced it. On the next invocation, Ninja notices that the cmc.d file is missing forcing a rebuild of that rule. rustc generates a new depfile, Ninja consumes and deletes it and so on which means that this process never converges.

I don't think rustc should be including the depfile itself in the generated depfile. I'm not aware of any other tool that would do that, and tools that consume depfiles such as Ninja cannot handle this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions