Skip to content

-Zmtime-on-use causes spurious rebuilds in workspace #6972

Closed
@Nemo157

Description

@Nemo157

Problem

Running a build using -p or --manifest-path to build individual crates from a workspace and -Zmtime-on-use to allow using cargo-sweep causes some of the dependencies to get rebuilt when they shouldn't.

I have tried to reproduce this in one other workspace I have and it didn't happen, it appears to be somehow specific to the workspace setup in Tide.

Steps

> git clone https://github.com/rustasync/tide && cd tide
Cloning into 'tide'...
[...]
> # current commit: 011d0db078d74e78ccf53f03605271b1bba60290

> cargo build -p tide -Zmtime-on-use
   [...far too many crates...]
   Compiling tide v0.2.0 (/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.TiMcd4ms/tide/tide)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 42s
> cargo build -p tide-core -Zmtime-on-use
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
> cargo build -p tide -Zmtime-on-use
   Compiling num-traits v0.2.7
   Compiling num-integer v0.1.40
   Compiling thread_local v0.3.6
   [...20 other crates.io dependencies...]
   Compiling tide-cookies v0.2.0 (/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.TiMcd4ms/tide/tide-cookies)
   Compiling tide v0.2.0 (/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.TiMcd4ms/tide/tide)
    Finished dev [unoptimized + debuginfo] target(s) in 16.87s

> # If -Zmtime-on-use isn't used then nothing gets rebuilt:
> cargo build -p tide
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
> cargo build -p tide-core
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
> cargo build -p tide
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s

Notes

Output of cargo version: cargo 1.36.0-nightly (759b6161a 2019-05-06)

cc @Eh2406

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