Skip to content
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

Missing package in Cargo.lock while it's present in Cargo.toml #15198

Closed
niebayes opened this issue Feb 18, 2025 · 2 comments
Closed

Missing package in Cargo.lock while it's present in Cargo.toml #15198

niebayes opened this issue Feb 18, 2025 · 2 comments

Comments

@niebayes
Copy link

Does cargo guarantee each items in Cargo.toml would be present in Cargo.lock?
I have introduced a package bytes (version 1.8.0) in Cargo.toml, but the Cargo.lock file only has a bytes package of version 1.9.0.
Is this an expected behavior of cargo?

@epage
Copy link
Contributor

epage commented Feb 18, 2025

Providing reproduction steps would be a big help to take the guess work out of answering your question.

I'm going to assume you have bytes = "1.8". That is a version requirement, one that specifies the minimum semver-compatible version to use. In recent versions of cargo, when it adds bytes to your lockfile, you'll see a message Locking latest compatible versions.

For more, see https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#version-requirement-syntax

@niebayes
Copy link
Author

@epage Thanks! I was thinking the version declared in Cargo.toml is the strict requirement that must be fulfilled, which is to say the actual used version is exactly the version declared in Cargo.toml. But it's not the case.

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

2 participants