Skip to content

Inconsistency between Cargo.toml and Cargo.lock for pre-release crate version #12942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sleshep opened this issue Nov 9, 2023 · 4 comments
Closed

Comments

@sleshep
Copy link

sleshep commented Nov 9, 2023

Issue
Cargo.lock does not match the pre-release version specified in Cargo.toml after running cargo add.

Reproduction Steps

  1. cargo new test_project
  2. cargo add [email protected]
  3. Cargo.toml correctly shows memflow = "0.2.0-beta10"
  4. Cargo.lock reflects memflow as 0.2.0-beta9

Expected
Both Cargo.toml and Cargo.lock should list memflow as 0.2.0-beta10.

Actual
Cargo.lock lists memflow as 0.2.0-beta9.

Cargo Version
cargo 1.75.0-nightly (7046d99 2023-11-08)

Operating System
Ubuntu 22.04

The discrepancy between lock and manifest files for a pre-release version is causing dependency resolution issues.

@epage
Copy link
Contributor

epage commented Nov 9, 2023

First, pre-releases aren't considered breaking changes between each other, so the lockfile and the manifest are free to disagree. There is discussion on this in #2222.

As for why beta9 was picked over beta10 is because semver precedence only does numeric comparisons for . delimited numbers. That would need to be beta.9 and beta.10.

@sleshep
Copy link
Author

sleshep commented Nov 9, 2023

@epage Thanks for the clarification; it resolved my issue. I'm closing this thread.

@sleshep sleshep closed this as completed Nov 9, 2023
@weihanglo
Copy link
Member

FWIW, use cargo add memflow@=0.2.0-beta10 if want exactly a specific pre-release version.

@sleshep
Copy link
Author

sleshep commented Nov 9, 2023

@weihanglo It works for me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants