Skip to content

lto = true causes dependency rebuilds when alternating cargo build and cargo build --tests #8669

Closed
@jonas-schievink

Description

@jonas-schievink

Problem

When setting lto = true in the dev profile, Cargo will rebuild all dependencies when switching between cargo build to cargo build --tests (and vice-versa).

Steps

  1. Check out https://github.com/jonas-schievink/cargo-lto-bug
  2. Run cargo build
  3. Run cargo build --tests
  4. Observe that Cargo rebuild the bitflags dependency

Notes

Output of cargo version: cargo 1.46.0 (149022b1d 2020-07-17)

Also happens on the current nightly, which is cargo 1.47.0-nightly (51b66125b 2020-08-19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ltoArea: link-time optimizationA-rebuild-detectionArea: rebuild detection and fingerprintingC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions