mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(cargo-update): once warn once for --precise <yanked>
This also tweaks the error message a bit.
This commit is contained in:
parent
bc5da432ef
commit
caeaaa529c
@ -261,6 +261,12 @@ pub struct RegistrySource<'cfg> {
|
|||||||
/// Otherwise, the resolver would think that those entries no longer
|
/// Otherwise, the resolver would think that those entries no longer
|
||||||
/// exist, and it would trigger updates to unrelated packages.
|
/// exist, and it would trigger updates to unrelated packages.
|
||||||
yanked_whitelist: HashSet<PackageId>,
|
yanked_whitelist: HashSet<PackageId>,
|
||||||
|
/// Yanked versions that have already been selected during queries.
|
||||||
|
///
|
||||||
|
/// As of this writing, this is for not emitting the `--precise <yanked>`
|
||||||
|
/// warning twice, with the assumption of (`dep.package_name()` + `--precise`
|
||||||
|
/// version) being sufficient to uniquely identify the same query result.
|
||||||
|
selected_precise_yanked: HashSet<(InternedString, semver::Version)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The [`config.json`] file stored in the index.
|
/// The [`config.json`] file stored in the index.
|
||||||
@ -531,6 +537,7 @@ impl<'cfg> RegistrySource<'cfg> {
|
|||||||
index: index::RegistryIndex::new(source_id, ops.index_path(), config),
|
index: index::RegistryIndex::new(source_id, ops.index_path(), config),
|
||||||
yanked_whitelist: yanked_whitelist.clone(),
|
yanked_whitelist: yanked_whitelist.clone(),
|
||||||
ops,
|
ops,
|
||||||
|
selected_precise_yanked: HashSet::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,13 +819,13 @@ impl<'cfg> Source for RegistrySource<'cfg> {
|
|||||||
let version = req
|
let version = req
|
||||||
.precise_version()
|
.precise_version()
|
||||||
.expect("--precise <yanked-version> in use");
|
.expect("--precise <yanked-version> in use");
|
||||||
let source = self.source_id();
|
if self.selected_precise_yanked.insert((name, version.clone())) {
|
||||||
let mut shell = self.config.shell();
|
let mut shell = self.config.shell();
|
||||||
shell.warn(format_args!(
|
shell.warn(format_args!(
|
||||||
"yanked package `{name}@{version}` is selected by the `--precise` flag from {source}",
|
"selected package `{name}@{version}` was yanked by the author"
|
||||||
))?;
|
))?;
|
||||||
shell.note("it is not recommended to depend on a yanked version")?;
|
shell.note("if possible, try a compatible non-yanked version")?;
|
||||||
shell.note("if possible, try other SemVer-compatbile versions")?;
|
}
|
||||||
}
|
}
|
||||||
if called {
|
if called {
|
||||||
return Poll::Ready(Ok(()));
|
return Poll::Ready(Ok(()));
|
||||||
|
@ -1419,9 +1419,8 @@ Caused by:
|
|||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[UPDATING] `dummy-registry` index
|
[UPDATING] `dummy-registry` index
|
||||||
[WARNING] yanked package `bar@0.1.1` is selected by the `--precise` flag from registry `dummy-registry`
|
[WARNING] selected package `bar@0.1.1` was yanked by the author
|
||||||
[NOTE] it is not recommended to depend on a yanked version
|
[NOTE] if possible, try a compatible non-yanked version
|
||||||
[NOTE] if possible, try other SemVer-compatbile versions
|
|
||||||
[UPDATING] bar v0.1.0 -> v0.1.1
|
[UPDATING] bar v0.1.0 -> v0.1.1
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
@ -1463,12 +1462,8 @@ fn precise_yanked_multiple_presence() {
|
|||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[UPDATING] `dummy-registry` index
|
[UPDATING] `dummy-registry` index
|
||||||
[WARNING] yanked package `bar@0.1.1` is selected by the `--precise` flag from registry `dummy-registry`
|
[WARNING] selected package `bar@0.1.1` was yanked by the author
|
||||||
[NOTE] it is not recommended to depend on a yanked version
|
[NOTE] if possible, try a compatible non-yanked version
|
||||||
[NOTE] if possible, try other SemVer-compatbile versions
|
|
||||||
[WARNING] yanked package `bar@0.1.1` is selected by the `--precise` flag from registry `dummy-registry`
|
|
||||||
[NOTE] it is not recommended to depend on a yanked version
|
|
||||||
[NOTE] if possible, try other SemVer-compatbile versions
|
|
||||||
[UPDATING] bar v0.1.0 -> v0.1.1
|
[UPDATING] bar v0.1.0 -> v0.1.1
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user