Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions doc/book/src/commands/cargo-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,6 @@ requirement in <code>Cargo.toml</code> doesn’t contain any pre-release identif
</dd>


<dt class="option-term" id="option-cargo-update---breaking"><a class="option-anchor" href="#option-cargo-update---breaking"><code>--breaking</code></a></dt>
<dd class="option-desc"><p>Update <em>spec</em> to highest SemVer-breaking version.</p>
<p>Version requirements will be modified to allow this update.</p>
<p>This only applies to dependencies when</p>
<ul>
<li>The package is a dependency of a workspace member</li>
<li>The dependency is not renamed</li>
<li>A SemVer-incompatible version is available</li>
<li>The “SemVer operator” is used (<code>^</code> which is the default)</li>
</ul>
<p>This option is unstable and available only on the
<a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html">nightly channel</a>
and requires the <code>-Z unstable-options</code> flag to enable.
See <a href="https://github.com/rust-lang/cargo/issues/12425">https://github.com/rust-lang/cargo/issues/12425</a> for more information.</p>
</dd>


<dt class="option-term" id="option-cargo-update--w"><a class="option-anchor" href="#option-cargo-update--w"><code>-w</code></a></dt>
<dt class="option-term" id="option-cargo-update---workspace"><a class="option-anchor" href="#option-cargo-update---workspace"><code>--workspace</code></a></dt>
<dd class="option-desc"><p>Attempt to update only packages defined in the workspace. Other packages
Expand Down
30 changes: 5 additions & 25 deletions doc/book/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Each new feature described below should explain how to use it.
* [msrv-policy](#msrv-policy) --- MSRV-aware resolver and version selection
* [precise-pre-release](#precise-pre-release) --- Allows pre-release versions to be selected with `update --precise`
* [sbom](#sbom) --- Generates SBOM pre-cursor files for compiled artifacts
* [update-breaking](#update-breaking) --- Allows upgrading to breaking versions with `update --breaking`
* [feature-unification](#feature-unification) --- Enable new feature unification modes in workspaces
* [lockfile-publish-time](#lockfile-publish-time) --- Limit resolver to packages older than the specified time
* [min-publish-age](#min-publish-age) --- Filters out dependency versions published more recently than a configured minimum age.
Expand Down Expand Up @@ -503,30 +502,6 @@ that are uplifted into the target or artifact directories.
}
```

## update-breaking
Comment thread
epage marked this conversation as resolved.

* Tracking Issue: [#12425](https://github.com/rust-lang/cargo/issues/12425)

Allow upgrading dependencies version requirements in `Cargo.toml` across SemVer
incompatible versions using with the `--breaking` flag.

This only applies to dependencies when
- The package is a dependency of a workspace member
- The dependency is not renamed
- A SemVer-incompatible version is available
- The "SemVer operator" is used (`^` which is the default)

Users may further restrict which packages get upgraded by specifying them on
the command line.

Example:
```console
$ cargo +nightly -Zunstable-options update --breaking
$ cargo +nightly -Zunstable-options update --breaking clap
```

*This is meant to fill a similar role as [cargo-upgrade](https://github.com/killercup/cargo-edit/)*

## build-std
* Tracking Repository: <https://github.com/rust-lang/wg-cargo-std-aware>

Expand Down Expand Up @@ -2485,3 +2460,8 @@ Support for `resolver.lockfile-path` config field has been stabilized in Rust 1.
## warnings

The `build.warnings` config field has been stabilized in Rust 1.97.

## update-breaking

The `cargo update -Zunstable-options --breaking` flag has been removed in 1.99-nightly.

@epage epage Aug 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs updating if this slips into the next release

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely to slip, though if it gets enough signoff today I'll just merge this. Doesn't need to wait 10 more days.

See <https://github.com/rust-lang/cargo/pull/17333> fopr the reason for its removal.
17 changes: 0 additions & 17 deletions doc/man/cargo-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,6 @@ A compatible `pre-release` version can also be specified even when the version
requirement in `Cargo.toml` doesn't contain any pre-release identifier (nightly only).
{{/option}}

{{#option "`--breaking`" }}
Update _spec_ to highest SemVer-breaking version.

Version requirements will be modified to allow this update.

This only applies to dependencies when
- The package is a dependency of a workspace member
- The dependency is not renamed
- A SemVer-incompatible version is available
- The "SemVer operator" is used (`^` which is the default)

This option is unstable and available only on the
[nightly channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html)
and requires the `-Z unstable-options` flag to enable.
See <https://github.com/rust-lang/cargo/issues/12425> for more information.
{{/option}}

{{#option "`-w`" "`--workspace`" }}
Attempt to update only packages defined in the workspace. Other packages
are updated only if they don't already exist in the lockfile. This
Expand Down
21 changes: 0 additions & 21 deletions doc/man/generated_txt/cargo-update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,6 @@ OPTIONS
version requirement in Cargo.toml doesn’t contain any pre-release
identifier (nightly only).

--breaking
Update spec to highest SemVer-breaking version.

Version requirements will be modified to allow this update.

This only applies to dependencies when

o The package is a dependency of a workspace member

o The dependency is not renamed

o A SemVer-incompatible version is available

o The “SemVer operator” is used (^ which is the default)

This option is unstable and available only on the nightly channel
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
requires the -Z unstable-options flag to enable. See
<https://github.com/rust-lang/cargo/issues/12425> for more
information.

-w, --workspace
Attempt to update only packages defined in the workspace. Other
packages are updated only if they don’t already exist in the
Expand Down
30 changes: 0 additions & 30 deletions etc/man/cargo-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,6 @@ A compatible \fBpre\-release\fR version can also be specified even when the vers
requirement in \fBCargo.toml\fR doesn\[cq]t contain any pre\-release identifier (nightly only).
.RE
.sp
\fB\-\-breaking\fR
.RS 4
Update \fIspec\fR to highest SemVer\-breaking version.
.sp
Version requirements will be modified to allow this update.
.sp
This only applies to dependencies when
.sp
.RS 4
\h'-04'\(bu\h'+03'The package is a dependency of a workspace member
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'The dependency is not renamed
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A SemVer\-incompatible version is available
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'The \[lq]SemVer operator\[rq] is used (\fB^\fR which is the default)
.RE
.sp
This option is unstable and available only on the
\fInightly channel\fR <https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html>
and requires the \fB\-Z unstable\-options\fR flag to enable.
See <https://github.com/rust\-lang/cargo/issues/12425> for more information.
.RE
.sp
\fB\-w\fR,
\fB\-\-workspace\fR
.RS 4
Expand Down
27 changes: 2 additions & 25 deletions src/bin/cargo/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ pub fn cli() -> Command {
.value_name("PRECISE")
.requires("package-group"),
)
.arg(
flag(
"breaking",
"Update [SPEC] to highest SemVer-breaking version (unstable)",
)
.short('b'),
)
.arg_silent_suggestion()
.arg(
flag("workspace", "Only update the workspace packages")
Expand All @@ -59,7 +52,7 @@ pub fn cli() -> Command {
}

pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
let mut ws = args.workspace(gctx)?;
let ws = args.workspace(gctx)?;

if args.is_present_with_zero_values("package") {
print_available_packages(&ws)?;
Expand Down Expand Up @@ -90,23 +83,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
gctx,
};

if args.flag("breaking") {
gctx.cli_unstable()
.fail_if_stable_opt("--breaking", 12425)?;

let upgrades = ops::upgrade_manifests(&mut ws, &update_opts.to_update)?;
ops::resolve_ws(&ws, update_opts.dry_run)?;
ops::write_manifest_upgrades(&ws, &upgrades, update_opts.dry_run)?;

if update_opts.dry_run {
update_opts
.gctx
.shell()
.warn("aborting update due to dry run")?;
}
} else {
ops::update_lockfile(&ws, &update_opts)?;
}
ops::update_lockfile(&ws, &update_opts)?;

Ok(())
}
Loading