mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Show original version_req for locked dependency
When encounter resolver error with locked dependency, we now show original version req along with the exact locked version.
This commit is contained in:
parent
c6762ce470
commit
d22623466d
@ -339,6 +339,16 @@ impl Dependency {
|
||||
self
|
||||
}
|
||||
|
||||
/// Locks this dependency to a specified version.
|
||||
///
|
||||
/// Mainly used in dependency patching like `[patch]` or `[replace]`, which
|
||||
/// doesn't need to lock the entire dependency to a specific [`PackageId`].
|
||||
pub fn lock_version(&mut self, version: &semver::Version) -> &mut Dependency {
|
||||
let me = Rc::make_mut(&mut self.inner);
|
||||
me.req.lock_to(version);
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns `true` if this is a "locked" dependency. Basically a locked
|
||||
/// dependency has an exact version req, but not vice versa.
|
||||
pub fn is_locked(&self) -> bool {
|
||||
|
@ -387,10 +387,16 @@ pub(crate) fn describe_path<'a>(
|
||||
} else {
|
||||
dep.name_in_toml().to_string()
|
||||
};
|
||||
let locked_version = dep
|
||||
.version_req()
|
||||
.locked_version()
|
||||
.map(|v| format!("(locked to {}) ", v))
|
||||
.unwrap_or_default();
|
||||
|
||||
write!(
|
||||
dep_path_desc,
|
||||
"\n ... which satisfies {}dependency `{}` of package `{}`",
|
||||
source_kind, requirement, pkg
|
||||
"\n ... which satisfies {}dependency `{}` {}of package `{}`",
|
||||
source_kind, requirement, locked_version, pkg
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -1000,7 +1000,7 @@ fn links_duplicates_old_registry() {
|
||||
but a native library can be linked only once
|
||||
|
||||
package `bar v0.1.0`
|
||||
... which satisfies dependency `bar = \"=0.1.0\"` of package `foo v0.1.0 ([..]foo)`
|
||||
... which satisfies dependency `bar = \"^0.1\"` (locked to 0.1.0) of package `foo v0.1.0 ([..]foo)`
|
||||
links to native library `a`
|
||||
|
||||
package `foo v0.1.0 ([..]foo)`
|
||||
|
Loading…
x
Reference in New Issue
Block a user