Repository navigation
Open
Labels
A-new-subcommandArea: new subcommandArea: new subcommandC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-updateS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.T-cargoTeam: CargoTeam: CargoZ-update-breakingNightly: update-breakingNightly: update-breakingdisposition-mergeFCP with intent to mergeFCP with intent to mergefinished-final-comment-periodFCP completeFCP complete
Description
Problem
A lot of incompatible upgrades have a small enough of breakages that a "upgrade all of my incompatible version requirements" would make it easier to go through this process.
This is currently exposed in the cargo upgrade command
Proposed Solution
Tasks
- update breaking
- Add
cargo update --breaking#13979- Test cases for
cargo update --breaking only-compatible renamed non-semver-operator transitive-dep
- Test cases for
-
--precise <breaking> - Call for testing
- Stabilization
- Add
- fix(update): Clarify meaning of --aggressive as --recursive #12544
- feat(pkgid): Allow incomplete versions when unambigious #12614
- feat(update): Tell users when they are still behind #13372
- fix(update): Make
-pmore convenient by being positional #12545 - bugs and identified tasks
- update: silent failure on non-matching package specs with --breaking #16276 error on unupgradeable specs
Deferred
- Modifying version requirements for compatible upgrades
See #12425 (comment)
Previously, https://internals.rust-lang.org/t/feedback-on-cargo-upgrade-to-prepare-it-for-merging/17101/141
Unresolved questions
- Flag name
--breakingto focus on semver (as this is limited to^)--incompatibleapplies to all version req operators and doesn't have a good short flag (-iis generally assumed to be "interactive")- Dart calls it
--major-versionsthough we have the issue of "absolute major" (x.0.0) and "relative major (also0.x.0,0.0.x).- budler calls it
--major
- budler calls it
- pnpm calls it
--latestbecause of a "latest" tag
- What unupgradeable cases should error vs warn vs ignore? update: silent failure on non-matching package specs with --breaking #16276 (comment)
- Maybe also clarifying why something is unupgradeable
Notes
Related
Reacted by Mo Bitar, Thorsten Sommer, Charles Samborski, Ed Morley, Azzam S.A, Thomas Versteeg, Rene Leonhardt, bircni, Jonas Wagner, musjj and 7 more
Reacted by Thorsten Sommer, David C., kamulos, stefnotch, Trevor Gross, Felix Rath, Azzam S.A, Rano | Ranadeep, Clément Nerma, Thomas Versteeg and 6 more
Metadata
Metadata
Assignees
Labels
A-new-subcommandArea: new subcommandArea: new subcommandC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-updateS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.T-cargoTeam: CargoTeam: CargoZ-update-breakingNightly: update-breakingNightly: update-breakingdisposition-mergeFCP with intent to mergeFCP with intent to mergefinished-final-comment-periodFCP completeFCP complete
Activity
epage commentedon Aug 1, 2023
Below is some background on what we are using to help come up with a design
Care Abouts
Priorities
cargo updateCargo.lockandCargo.tomlPrimary use cases:
cargo update)Secondary use cases are:
Some open questions we had
tokio_03is pinned or not?--excludethese dependencies but that might be a bit of a pain to always remember to doContext
Currently,
cargo updateis focused solely onCargo.lockeditingname@versionVersion requirement editing is different in that
And as a reminder of the CLI:
Note:
cargo add --lockedwill also fail if the manifest will changeSome design tools we can consider include
cargo <cmd> --helpandcargo --listwill point people to the new namefoo@versyntax for versions and version requirementsCargo.lockmostly align withCargo.toml, making it easier to conflate the two commands (whether merging them or keeping separate but de-emphasizingupdate)Interjection
Through this, I realized that the core of my concern with our previous attempts at a single command is that it feels like we are shoehorning new behaviors into
cargo updaterather than making the behavior cohesive.cargo update --incompatibleon a blog post, can I predict what will happen if you docargo update? No, because--saveis needed to match behavior--packagebe both for package IDs and dependency names to make some of thecargo upgradeworkflows work--preciseto allow control over version requirementsI also realized that my Windows Updates vs Windows Upgrades analogy for
cargo updateandcargo upgradebreaks down a little becausecargo upgradecan do "upgrades" that are on the level ofcargo update(say we call itcargo upgrade --compatible). The difference is in the target audience (yourself vs your dependents)epage commentedon Aug 1, 2023
Proposal:
cargo updateonly changes version requirements as a side effectThe primary role of
cargo updatehas been to update your active dependencies (ieCargo.lock). We do not plan to change that role but give the user control to force it to update in situations that were previously unsupported, particularly updating theCargo.tomlif need be.Behavior:
cargo update --incompatible/cargo update -iwill force (ie update version reqs) update unpinned, incompatible versions (no other dependencies)--breakingor something else. The name depends on what expresses the concept clearly especially in light of any pinning behavior we have-iunused would keep the door for a--interactiveto be addedcargo update -p foo --precise verwill force the update to happen, only erroring if we can't (don't own relevant version reqs, is pinned), even if its incompatible but unpinned. Version requirement is only changed on incompatible.Somewhere between deferred and rejected (speaking for myself): Support in
cargo updatefor writing to the manifest for non-breaking changes, like bulk compatible upgrades of version requirements (ie a-saveflag) which was one of our lower priority workflows. A--saveflag is more about updating versions for your dependents, which while important for having valid lower-bounds on version requirements, doesn't fit with the existing model ofcargo update. Maybe in the future we can find a way to express this incargo updatethat fits with how it works or maybe another command can take on this role. We just aren't wanting to distract our efforts for handling most of the use cases to handle this one. See #10498While this tells a cohesive story, a part of me is somewhat concerned that this goes beyond the name
update.Potential related
cargo updateimprovements--aggressiveto--recursive(make--aggressivean alias for the new name) (fix(update): Clarify meaning of --aggressive as --recursive #12544)foo@x.y.zso thatfoo@xwill work so long as its unambiguous (which it should be), much likecargo install foo@x.y.zsupports auto-selecting theyandzfields (picks latest) (feat(pkgid): Allow incomplete versions when unambigious #12614)cargo upgradeintocargo update(feat(update): Tell users when they are still behind #13372)cargo outdatedexperience (Makecargo outdatedpart of cargo itself #4309)cargo updateshould print warnings for incompatible candidates #7167)packageargument tocargo update, removing the need for--package(fix(update): Make-pmore convenient by being positional #12545)0..=1valuesAlternatives
These are alternatives I had considered that help give an idea of what I mean by fitting into cargo.
cargo updatealways modifiesCargo.tomlWe deprecate
cargo updateand acargo upgradealways updates both filesWe migrate to minimal-version resolution by default
cargo updatebecomes less useful and we move it out of the spot light.cargo upgradeis added that is focused on editing version requirementsSeparate commands for
Cargo.lock(update) andCargo.toml(upgrade)apt dist-upgrade, maybe it could becargo req-update?Misc Notes
^as we document them as being the same thing and sometimes people use^just becausecargo update && cargo update --incompatiblevscargo update --incompatibledoing both as there are people who do want them separated and running two commands, while annoying, allows us to cover more use cases.Auto merge of #12428 - epage:update, r=weihanglo
epage commentedon Aug 8, 2023
This proposal has been up here and on internals for a bit now without any major concerns raised.
@rfcbot fcp merge
rfcbot commentedon Aug 8, 2023
Team member @epage has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
djc commentedon Aug 8, 2023
Having been fairly involved in this discussion via the internals thread, I'm happy to see this move forward in a direction that I wholeheartedly support. @epage thanks for pushing this forward!
rfcbot commentedon Aug 14, 2023
🔔 This is now entering its final comment period, as per the review above. 🔔
78 remaining items
TheLostLambda commentedon Aug 8, 2024
And just to have this all in the same place, from #14178 (comment):
Perhaps that's better as
2.0.0-beta.1to3.0.0? That way you have to opt into each pre-release series, but you never "skip over" a chance to return to stable?So this upgrading between pre-releases only happens when all of the pre-releases have that same MAJOR, MINOR, and PATCH versions, and otherwise it looks for a newer stable version to upgrade to?
ia0 commentedon Aug 8, 2024
Yes, I agree the logic should be:
(Note that even though I'm writing that, that's not what I would like to use. I would like something like #14372. But it could be a separate flag.)
epage commentedon Aug 8, 2024
From what I understand of the current semantics, they are what they should be.
--breakingis a "force" flag to update a dependency when a^operator would otherwise prevent the update.At this time, updating through pre-releases is not a breaking change, so
--breakingdoes not apply (see #6016, #2222, #3263). If you work around that with=, then--breakingstill does not apply.To update pre-releases that use
^, then we need the feature that is left out of this Issue, a way to bump the minimum of version reqs to what is in the lockfile (see #10498).cargo update --breakingshould not change compatible version requirementscargo update --breakingshould not change compatible version requirementsWe need to clarify the semantics for how to handle this case
SUPERCILEX commentedon Oct 19, 2024
@VorpalBlade I just ran into the same issue as you, seems like updating non-breaking versions (#12425 (comment)) is now being tracked here: #10498.
fix(update)!: Remove unstable `--breaking`
fix(update)!: Remove unstable `--breaking`
fix(update)!: Remove unstable `--breaking` (rust-lang#17333)
chrisduerr commentedon Sep 19, 2026
I'm surprised to see how little activity this issue gets, after just running into the removal of
cargo update --breaking -Z unstable-optionsfrom nightly. To me this has been one of the biggest QoL improvements to cargo that I can remember, so I'm sad to see it go.I would like to make the argument against just delegating to
cargo upgradeindefinitely, since there's numerous issues with that to me. Personally I'm not a big fan of installing cargo plugins, since it's much more difficult to have faith in their quality (though cargo-edit is well maintained) and they are difficult to update (unless you want to install a plugin to manage your plugins).I think one of the main problems is the experience for new users. Even in here, people mostly refer to the alternative as
cargo upgrade, but finding that alone is difficult, since the plugin is actually calledcargo-editwith another plugin existing namedcargo-update. I'm honestly surprised there haven't been any typosquatting attacks on this (though maybe they've just been at a scale small enough for me not to notice). Being able to just do what you want 90% of the time (which is what--breakingdid for me in nightly) right there in cargo would certainly be useful to someone starting out with cargo and just looking through all the options.Ultimately I'm not asking for any change here, I'd just like to emphasize that the previous attempt has provided real value to users. If there's better ideas, it's obviously best to get it right from the start, but it would be a shame to never see this land in cargo just because no proposal is perfect.
VorpalBlade commentedon Sep 19, 2026
It was unstable, I never knew (or at least remembered) it was there. I used
cargo upgradeadd-on all along. As most users probably did. So the nightly feature was badly publicized if they actually wanted testing of it.martinetd commentedon Sep 19, 2026
FWIW I actually used
cargo +nightly -Z unstable-options update --breakingand only bothered to install cargo-edit after this was yanked recently. Didn't run into any problem with the unstable option.Timmmm commentedon Oct 16, 2026
So what's the status of this? I was very patiently waiting for it to be stabilised and now it's been removed?
I think it would help if the very top of the issue could get some kind of bold status box so we don't have to read through 130 comments to see what is going on. Something like this:
--breakingflag, however that was removed in August 2026 in order to simplify development of alternative options. We decided not to go with--breakingbecause ????. The new provision plan is ????.