Skip to content

Cargo should skip crates.io check with --locked and all dependencies already resolved #10984

Open
@mqudsi

Description

@mqudsi

Last week there was a temporary outage of crates.io and my build requests were all hanging on "Updating crates.io index" even though they were subsequent invocations of the same cargo command, seconds apart, with --locked specified, e.g.

> cargo install --locked --path .
> cargo install --locked --path .

If all the dependencies in Cargo.toml are in Cargo.lock and Cargo.lock is itself in a fully consistent state with no missing dependencies, cargo install --locked should be equivalent to cargo install --offline --locked (which is what I ended up using). (Please let me know if I'm missing something that cargo needs internet access for if all dependencies are present and account for.)

I would also argue that there should be some sort of recency check before cargo install forces an update of the crates.io index, regardless of whether or not --locked was specified. If all dependencies are present and account for and the lock file is in a consistent state and all integrity checks pass, there's no reason for to back-to-back invocations of cargo install --path ... to hit the crates.io server (slowing down the effective/observed compile time, generating unnecessary load on the crates.io server, and raising privacy concerns).

Experienced with cargo 1.63.0-nightly (8d42b0e 2022-06-17)

@rustbot label +T-cargo +A-incr-comp +I-compiletime

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions