-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Do not update semantically equivalent lockfiles with --frozen/--locked. #4714
Conversation
// just ignore it if we are in the `--frozen` mode. | ||
if !lock_update_allowed && orig.starts_with("[root]") { | ||
orig = orig.replacen("[root]", "[[package]]", 1); | ||
match (orig.parse::<toml::Value>(), current.parse::<toml::Value>()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😭
I've checked that toml::Value
uses BTree
for maps, but of course it is irrelevant here, because [[package]]
is an array, and not a map.
src/cargo/core/resolver/encode.rs
Outdated
/// | ||
/// For example, even with [root] being present in one and not in the other, | ||
/// the semantic meaning is still the same, so return true. | ||
pub fn semantically_eq(self, other: Self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am somewhat afraid that these needs to be updated every time we add new field to EncodableResolve
.
Perhaps we should have fn normalize(&mut self)
, and then use natural equality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @matklad in that we may want to pursue alternative means if we can, for example can into_resolve
be used below and then we would equate two instances of Resolve
?
A previous patch in rust-lang#4684 attempted to fix this, but didn't work for the case where the [root] crate wasn't the first crate in the sorted package array.
ae276f6
to
89023dc
Compare
Updated. |
@bors: r+ |
📌 Commit 89023dc has been approved by |
Do not update semantically equivalent lockfiles with --frozen/--locked. A previous patch in #4684 attempted to fix this, but didn't work for the case where the [root] crate wasn't the first crate in the sorted package array. cc @matklad -- fixes a problem noted in #4684 (comment) which appears to have gone unfixed r? @alexcrichton Beta backport will be posted as soon as this is reviewed. Merges cleanly.
☀️ Test successful - status-appveyor, status-travis |
A previous patch in #4684 attempted to fix this, but didn't work for the
case where the [root] crate wasn't the first crate in the sorted package
array.
cc @matklad -- fixes a problem noted in #4684 (comment) which appears to have gone unfixed
r? @alexcrichton
Beta backport will be posted as soon as this is reviewed. Merges cleanly.