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

fix(cargo): fix handling of x and x.y versions #26263

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

rami3l
Copy link
Contributor

@rami3l rami3l commented Dec 13, 2023

Changes

This PR changes the handling of cargo versions to be "caret by default".

Context

The Rustup project is now using what has been made available in #25983, which works well for an update from 1.2.0 to 1.4.1, for example, where the manifest is untouched under the rangeStrategy: update-lockfile mode.
However, when an update from 1.2 to 1.4 is detected, the manifest is still updated (see rust-lang/rustup#3569 (comment)).

The root cause of this issue seems to be that the current implementation of cargo versioning incorrectly assumes the following:

// NOTE: Partial versions like '1.2' don't get converted to '^1.2'
// because isVersion('1.2') === false
// In cargo and in npm 1.2 is equivalent to 1.2.* so it is correct behavior.

... however in cargo 1.2 is handled the same way as ^1.2, as documented in https://doc.rust-lang.org/stable/cargo/reference/specifying-dependencies.html#caret-requirements.

This PR combined with the previous #25983 should be able to address rust-lang/rustup#3541.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@rami3l rami3l changed the title fix(cargo): fix handling for x and x.y versions fix(cargo): fix handling of x and x.y versions Dec 13, 2023
@rami3l rami3l requested a review from viceice December 13, 2023 10:49
@rarkins rarkins added this pull request to the merge queue Dec 13, 2023
@rarkins
Copy link
Collaborator

rarkins commented Dec 13, 2023

@rami3l thanks for the elegant fix!

Merged via the queue into renovatebot:main with commit f9ae909 Dec 13, 2023
36 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.92.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rami3l rami3l deleted the fix/cargo-versioning branch December 13, 2023 15:53
hersentino pushed a commit to hiventive/renovate that referenced this pull request Jan 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants