mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
fix: Improved error message when update --breaking invalid spec.
This commit is contained in:
parent
631b8774e5
commit
57622d7939
@ -14,6 +14,7 @@ use crate::util::toml_mut::manifest::LocalManifest;
|
|||||||
use crate::util::toml_mut::upgrade::upgrade_requirement;
|
use crate::util::toml_mut::upgrade::upgrade_requirement;
|
||||||
use crate::util::{style, OptVersionReq};
|
use crate::util::{style, OptVersionReq};
|
||||||
use crate::util::{CargoResult, VersionExt};
|
use crate::util::{CargoResult, VersionExt};
|
||||||
|
use anyhow::Context as _;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use semver::{Op, Version, VersionReq};
|
use semver::{Op, Version, VersionReq};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
@ -224,7 +225,10 @@ pub fn upgrade_manifests(
|
|||||||
|
|
||||||
let to_update = to_update
|
let to_update = to_update
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| PackageIdSpec::parse(s))
|
.map(|spec| {
|
||||||
|
PackageIdSpec::parse(spec)
|
||||||
|
.with_context(|| format!("invalid package ID specification: `{spec}`"))
|
||||||
|
})
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
// Updates often require a lot of modifications to the registry, so ensure
|
// Updates often require a lot of modifications to the registry, so ensure
|
||||||
|
@ -2263,7 +2263,10 @@ fn update_breaking_spec_version() {
|
|||||||
.masquerade_as_nightly_cargo(&["update-breaking"])
|
.masquerade_as_nightly_cargo(&["update-breaking"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_data(str![[r#"
|
.with_stderr_data(str![[r#"
|
||||||
[ERROR] expected a version like "1.32"
|
[ERROR] invalid package ID specification: `incompatible@foo`
|
||||||
|
|
||||||
|
Caused by:
|
||||||
|
expected a version like "1.32"
|
||||||
|
|
||||||
"#]])
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user