Skip to content

cargo install when only pre-releases are available #14509

Open
@eopb

Description

@eopb

Problem

It's possible for crates to have only published pre-release versions to crates.io. This was the case for early versions of my crate, cargo-override.

My reason for doing this was due to the subtle difference between what I felt each version communicated.

  • 0.0.x series, communicates that the API is unstable and may change in every release.
  • 0.1.0-alpha.x series. communicates that the API is unstable, may change every release, and the behaviour may be broken or buggy.

Other than this difference I perceive in what these versions communicate, their SemVer obligations are effectively the same.

This test, eopb/cargo/pull/1/files, displays the current behaviour. This behaviour is confusing for the following reasons:

  • The error returned does not recommend cargo install crate@version but instead may suggest to users that no crate with that name is in the registry
  • The behaviour does not match what crates.io displays. crates.io is happy to display pre-release versions by default if they are the only versions available

Proposed Solution

When only pre-release versions are available, select the pre-release with the greatest version, as specified by ordering in the semver crate

Notes

No response

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`Command-installS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions