Skip to content

Support for early cutoff #17439

Description

@ranger-ross

Problem

Currently when updating a leaf dependency all crates that depend on it are rebuilt (both directly and transitively).
This means that a simple dependency bump can force large part of the dependency tree to recompile when it otherwise wouldn't need to.

Proposed Solution

Build systems like Bazel only rebuild a unit if the of tasks inputs have changed.
This is known as "Early Cutoff". 1

This differs from Cargo's implementation in that the dependencies for a build unit are the dependents outputs.
Cargo only uses the inputs of dependency units, so if the output (rlib) does not change it still rebuilds dependent units.

The proposed solution is to modify Cargo's fingerprinting system to use build unit outputs (instead of inputs) when determining a units fingerprint. Avoiding rebuilds of the inputs of a previous build unit did not changes it output.

Image

Notes

This may be a good opportunity to re-evaluate at a high level how fingerprinting works in cargo in general

Footnotes

  1. Mentioned in Build systems à la carte. I don't know the origin.

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

    A-rebuild-detectionArea: rebuild detection and fingerprintingC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions