Skip to content

Add warning when cargo install --locked used, but there is no Cargo.lock available #9106

@dekellum

Description

@dekellum

This warning would help understanding the cause of install failures, as in this URLO Thread.

So for example, cargo-graph 0.3.1 was published without a Cargo.lock (prior to that feature being stabilized in cargo 1.37), and so using the --locked flag has no effect (the build still fails due to a yanked dependency). It would be much easier to understand why --locked doesn't help, if the following warning was introduced in the output:

cargo install cargo-graph --locked 
    Updating crates.io index
  Installing cargo-graph v0.3.1
+warning: no Cargo.lock file published in cargo-graph v0.3.1
error: failed to compile `cargo-graph v0.3.1`, intermediate artifacts can be found at `/tmp/cargo-installdryLBw`

Caused by:
  failed to select a version for the requirement `clap = "~2.11.3"`
  candidate versions found which didn't match: 2.33.3, 2.33.2, 2.33.1, ...
  location searched: crates.io index
  required by package `cargo-graph v0.3.1`

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions