Skip to content

Needless rebuilds when run with or without --workspace #9114

Closed
@ijackson

Description

@ijackson

Problem

cargo rebuilds things if I switch between cargo build and cargo build --workspace.

Steps

  1. git clone https://salsa.debian.org/iwj/otter
  2. cd otter
  3. git checkout c9b5a88d7a33a6e1eac22736be0a38c6815e1706
  4. cargo build --workspace
  5. cargo build

To repeat, restarting from after step 4 or 5:

  1. touch src/updates.rs
  2. as above
  3. as above

Expected behaviour

The whole workspace including the toplevel package otter was built in step 4, so step 5 should not build anything and should be very quick.

Actual behaviour

cargo rebuilds otter (including library and binaries) in step 5 (about six seconds on my laptop in a repeated test)

Notes

Output of cargo version:

cargo 1.51.0-nightly (783bc43c6 2021-01-20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions