Skip to content

Add warning for using pre-release version in Cargo.toml #14876

Open
@linyihai

Description

Problem

As rust-lang/rfcs#3263 mentions and the cargo book says:

Cargo allows “newer” pre-releases to be used automatically. For example, if 1.0.0-beta is published, then a requirement foo = "1.0.0-alpha" will allow updating to the beta version. Note that this only works on the same release version, foo = "1.0.0-alpha" will not allow updating to foo = "1.0.1-alpha" or foo = "1.0.1-beta".

Cargo will also upgrade automatically to semver-compatible released versions from prereleases. The requirement foo = "1.0.0-alpha" will allow updating to foo = "1.0.0" as well as foo = "1.2.0".

It is necessary to notice user (especially new rust comer) that Cargo will upgrade the pre-release version, which is may be a breaking change.

Proposed Solution

When resolving the Cargo.toml, if there is any pre-release version present, warnning people that pre-release will automatically upgrade to new version, which may be a breaking change.

It's prefer to choose lint to generate the warning message.

Notes

originated from rust-lang/rfcs#3263 (comment)

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`S-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