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

feat: stabilize cargo update --precise <yanked> #13974

Merged
merged 1 commit into from
May 29, 2024
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
7 changes: 1 addition & 6 deletions src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,15 +819,10 @@ impl<'gctx> Source for RegistrySource<'gctx> {
callback(s);
} else if req.is_precise() {
precise_yanked_in_use = true;
if self.gctx.cli_unstable().unstable_options {
callback(s);
}
callback(s);
}
}))?;
if precise_yanked_in_use {
self.gctx
.cli_unstable()
.fail_if_stable_opt("--precise <yanked-version>", 4225)?;
let name = dep.package_name();
let version = req
.precise_version()
Expand Down
5 changes: 3 additions & 2 deletions src/doc/man/cargo-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ When used with _spec_, allows you to specify a specific version number to set
the package to. If the package comes from a git repository, this can be a git
revision (such as a SHA hash or tag).

While not recommended, you can specify a yanked version of a package (nightly only).
While not recommended, you can specify a yanked version of a package.
When possible, try other non-yanked SemVer-compatible versions or seek help
from the maintainers of the package.

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).
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 "`-w`" "`--workspace`" }}
Expand Down
7 changes: 3 additions & 4 deletions src/doc/man/generated_txt/cargo-update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ OPTIONS
to set the package to. If the package comes from a git repository,
this can be a git revision (such as a SHA hash or tag).

While not recommended, you can specify a yanked version of a package
(nightly only). When possible, try other non-yanked
SemVer-compatible versions or seek help from the maintainers of the
package.
While not recommended, you can specify a yanked version of a
package. When possible, try other non-yanked SemVer-compatible
versions or seek help from the maintainers of the package.

A compatible pre-release version can also be specified even when the
version requirement in Cargo.toml doesn’t contain any pre-release
Expand Down
5 changes: 3 additions & 2 deletions src/doc/src/commands/cargo-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ Cannot be used with <code>--precise</code>.</dd>
<dd class="option-desc">When used with <em>spec</em>, allows you to specify a specific version number to set
the package to. If the package comes from a git repository, this can be a git
revision (such as a SHA hash or tag).</p>
<p>While not recommended, you can specify a yanked version of a package (nightly only).
<p>While not recommended, you can specify a yanked version of a package.
When possible, try other non-yanked SemVer-compatible versions or seek help
from the maintainers of the package.</p>
<p>A compatible <code>pre-release</code> version can also be specified even when the version requirement in <code>Cargo.toml</code> doesn’t contain any pre-release identifier (nightly only).</dd>
<p>A compatible <code>pre-release</code> version can also be specified even when the version
requirement in <code>Cargo.toml</code> doesn’t contain any pre-release identifier (nightly only).</dd>


<dt class="option-term" id="option-cargo-update--w"><a class="option-anchor" href="#option-cargo-update--w"></a><code>-w</code></dt>
Expand Down
5 changes: 3 additions & 2 deletions src/etc/man/cargo-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ When used with \fIspec\fR, allows you to specify a specific version number to se
the package to. If the package comes from a git repository, this can be a git
revision (such as a SHA hash or tag).
.sp
While not recommended, you can specify a yanked version of a package (nightly only).
While not recommended, you can specify a yanked version of a package.
When possible, try other non\-yanked SemVer\-compatible versions or seek help
from the maintainers of the package.
.sp
A compatible \fBpre\-release\fR version can also be specified even when the version requirement in \fBCargo.toml\fR doesn\[cq]t contain any pre\-release identifier (nightly only).
A compatible \fBpre\-release\fR version can also be specified even when the version
requirement in \fBCargo.toml\fR doesn\[cq]t contain any pre\-release identifier (nightly only).
.RE
.sp
\fB\-w\fR,
Expand Down
22 changes: 0 additions & 22 deletions tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,26 +1450,6 @@ fn precise_yanked() {
assert!(lockfile.contains("\nname = \"bar\"\nversion = \"0.1.0\""));

p.cargo("update --precise 0.1.1 bar")
.with_status(101)
.with_stderr(
"\
[UPDATING] `dummy-registry` index
[ERROR] failed to get `bar` as a dependency of package `foo v0.0.0 ([CWD])`

Caused by:
failed to query replaced source registry `crates-io`

Caused by:
the `--precise <yanked-version>` flag is unstable[..]
See [..]
See [..]
",
)
.run();

p.cargo("update --precise 0.1.1 bar")
.masquerade_as_nightly_cargo(&["--precise <yanked-version>"])
.arg("-Zunstable-options")
.with_stderr(
"\
[UPDATING] `dummy-registry` index
Expand Down Expand Up @@ -1511,8 +1491,6 @@ fn precise_yanked_multiple_presence() {
assert!(lockfile.contains("\nname = \"bar\"\nversion = \"0.1.0\""));

p.cargo("update --precise 0.1.1 bar")
.masquerade_as_nightly_cargo(&["--precise <yanked-version>"])
.arg("-Zunstable-options")
.with_stderr(
"\
[UPDATING] `dummy-registry` index
Expand Down