Skip to content

Tracking issue for -Z binary-dep-depinfo #63012

Description

@ehuss

This is a tracking issue for -Z binary-dep-depinfo added in #61727.
The cargo side is implemented in rust-lang/cargo#7137.

Blockers:

  • Canonicalized paths on Windows. The dep-info file includes a mix of dos-style and extended-length (\\?\) paths, and I think we want to use only one style (whatever is compatible with make and other tools). See the PR for details.
  • Codegen backends are not tracked.

cc @Mark-Simulacrum @alexcrichton

Activity

  1. added
    B-unstableBlocker: Implemented in the nightly compiler and unstable.
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Jul 26, 2019
  2. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Jul 26, 2019
  3. added a commit that references this issue on Aug 14, 2019
  4. added 5 commits that reference this issue on Aug 15, 2019
  5. Mark-Simulacrum commented on Jan 19, 2020

    @Mark-Simulacrum
    Member

    In #68298 we fixed binary dep-depinfo to be less eager to emit dependencies on dylib/rlib files when emitting rlibs and rmeta files, as we only need rmeta input in that case.

    It was also noted that we currently do not correctly emit plugin dependencies (I'm not entirely sure of this, but seems not implausible).

  6. fangism commented on Sep 24, 2021

    @fangism
  7. 8 remaining items

  8. est31 commented on Sep 19, 2022

    @est31
    Member

    cargo-udeps uses the feature since the 0.1.33 release to figure out which dependencies were actually used during compilation, since save-analysis is going to be removed.

  9. est31 commented on Sep 28, 2022

    @est31
    Member

    The linux kernel uses the flag too: Rust-for-Linux/linux#2

    Used by: Kbuild.

    Status: we could get around it by making the build system more complicated (particularly if the kernel does not upgrade the minimum Make version), but it would be best to avoid that.

  10. pvdrz commented on Nov 21, 2022

    @pvdrz
    Contributor

    The linux kernel uses the flag too: Rust-for-Linux/linux#2

    Used by: Kbuild.
    Status: we could get around it by making the build system more complicated (particularly if the kernel does not upgrade the minimum Make version), but it would be best to avoid that.

    Apparently it is necessary to avoid recompiling in some scenarios: Rust-for-Linux/linux#2 (comment)

    Without -Zbinary-dep-depinfo rustc will only put the source files and the compiled output in the depinfo file. With -Zbinary-dep-depinfo rustc will also add .rmeta, .rlib, ... dependencies to the depinfo file. Without this changing a depensency wouldn't cause make to rebuild dependent crates. Cargo doesn't have this issue as it already knows the dependencies on it's own and only needs the depinfo file for the source file list, but make really needs everything.

  11. added
    A-CLIArea: Command-line interface (CLI) to the compiler
    on Mar 5, 2023
  12. jyn514 commented on May 8, 2023

    @jyn514
    Member

    I can speak to the use-case in my case: we're using a large distributed build system at $work in which packages are automatically re-built if their dependencies change. Which, for example, means that if we for example need a patch to rustc to work around some internal issue, then rustc is re-built. And then anything that uses rustc is re-built. But without -Zbinary-dep-depinfo Cargo doesn't understand that rustc has changed since the version number remains the same, and so doesn't realize that it must also re-build the various Rust artifacts.

    I am confused by this statement. binary-dep-depinfo does not emit the path to the toolchain currently: https://github.com/rust-lang/rust/blob/1fa1f5932b487a2ac4105deca26493bb8013a9a6/compiler/rustc_interface/src/passes.rs#L490-L511
    Exactly what is your setup? I don't understand why this would be working for you but not for bootstrap.

  13. jonhoo commented on May 8, 2023

    @jonhoo
    Contributor

    Ah, so, to be clear, we don't currently use -Zbinary-dep-depinfo. Instead, incremental builds currently just break if we ever happen to have to do this. What I wrote was aspirational: we want depinfo tracking in the hopes that it will let Cargo/rustc detect this situation (rustc changing without the version changing) and handle it correctly.

  14. bjorn3 commented on May 8, 2023

    @bjorn3
    Member

    We do currently use -Zbinary-dep-depinfo for making cargo rebuild everything, however when incremental compilation is enabled, it is not enough to trigger a rebuild. The incr comp cache needs to be cleared too. In addition if a crate version changes, that seems to cause issues too.

  15. Mark-Simulacrum commented on May 8, 2023

    @Mark-Simulacrum
    Member

    Cc #111329 (comment) which I believe should help explain why it's not currently enough for dependency version changes, I suspect a similar change for incremental may also be helpful but I haven't looked at incremental encoding/decoding.

  16. bjorn3 commented on May 9, 2023

    @bjorn3
    Member

    For incremental it wouldn't help. Even if the encoding is exactly identical the encoded query results may have changed between versions. We need to clear the incr cache unconditionally if rustc changes.

  17. jonhoo commented on May 12, 2023

    @jonhoo
    Contributor

    To loop in some other tickets that have touched on "re-building if rustc changes" in the past: rust-lang/cargo#10664 and rust-lang/cargo#10367 are possibly relevant.

  18. jyn514 commented on May 12, 2023

    @jyn514
    Member

    rust-lang/cargo#10367 is a different problem. That's about if the path to the compiler changes; the problem in this issue happens when the path and version output stay the same and only the mtine is different.

  19. moved this to Unstable, no backers in Cargo Roadmapon Sep 5, 2023
  20. added
    T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    on Mar 23, 2025
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

    A-CLIArea: Command-line interface (CLI) to the compilerB-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-design-concernsStatus: There are blocking design concerns.S-tracking-needs-summaryStatus: It's hard to tell what's been done and what hasn't! Someone should do some investigation.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-cargoRelevant to the cargo team, which will review and decide on the PR/issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions