From a076f7921b5f36e3528d47ff76b0d67950d633db Mon Sep 17 00:00:00 2001
From: Weihang Lo
Date: Tue, 28 May 2024 13:13:56 -0400
Subject: [PATCH] feat: stabilize `cargo update --precise `
---
src/cargo/sources/registry/mod.rs | 7 +------
src/doc/man/cargo-update.md | 5 +++--
src/doc/man/generated_txt/cargo-update.txt | 7 +++----
src/doc/src/commands/cargo-update.md | 5 +++--
src/etc/man/cargo-update.1 | 5 +++--
tests/testsuite/update.rs | 22 ----------------------
6 files changed, 13 insertions(+), 38 deletions(-)
diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs
index 0c9326cdd09..ff852b134fb 100644
--- a/src/cargo/sources/registry/mod.rs
+++ b/src/cargo/sources/registry/mod.rs
@@ -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 ", 4225)?;
let name = dep.package_name();
let version = req
.precise_version()
diff --git a/src/doc/man/cargo-update.md b/src/doc/man/cargo-update.md
index c3ba31971c1..3031afa5fbb 100644
--- a/src/doc/man/cargo-update.md
+++ b/src/doc/man/cargo-update.md
@@ -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`" }}
diff --git a/src/doc/man/generated_txt/cargo-update.txt b/src/doc/man/generated_txt/cargo-update.txt
index bcfcf296b39..1bcc1390f7b 100644
--- a/src/doc/man/generated_txt/cargo-update.txt
+++ b/src/doc/man/generated_txt/cargo-update.txt
@@ -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
diff --git a/src/doc/src/commands/cargo-update.md b/src/doc/src/commands/cargo-update.md
index c34f91168f9..8de0bee9850 100644
--- a/src/doc/src/commands/cargo-update.md
+++ b/src/doc/src/commands/cargo-update.md
@@ -40,10 +40,11 @@ Cannot be used with --precise
.
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).
-w
diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1
index f8468059f1c..de4770fcacb 100644
--- a/src/etc/man/cargo-update.1
+++ b/src/etc/man/cargo-update.1
@@ -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,
diff --git a/tests/testsuite/update.rs b/tests/testsuite/update.rs
index 2c72ae341b4..2e6d8daf6c8 100644
--- a/tests/testsuite/update.rs
+++ b/tests/testsuite/update.rs
@@ -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 ` flag is unstable[..]
- See [..]
- See [..]
-",
- )
- .run();
-
- p.cargo("update --precise 0.1.1 bar")
- .masquerade_as_nightly_cargo(&["--precise "])
- .arg("-Zunstable-options")
.with_stderr(
"\
[UPDATING] `dummy-registry` index
@@ -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 "])
- .arg("-Zunstable-options")
.with_stderr(
"\
[UPDATING] `dummy-registry` index