From 5da9bed1e5fcbe08fcd74edc7c3d4befced654b9 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Sat, 28 Aug 2021 12:57:41 +0800 Subject: [PATCH 1/2] print the full destination path when no track duplicates Signed-off-by: hi-rustin --- src/cargo/ops/cargo_install.rs | 8 +++++++- tests/testsuite/install_upgrade.rs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cargo/ops/cargo_install.rs b/src/cargo/ops/cargo_install.rs index ad62de96d52..f90e017db34 100644 --- a/src/cargo/ops/cargo_install.rs +++ b/src/cargo/ops/cargo_install.rs @@ -258,7 +258,13 @@ impl<'cfg, 'a> InstallablePackage<'cfg, 'a> { if !self.force && !duplicates.is_empty() { let mut msg: Vec = duplicates .iter() - .map(|(name, _)| format!("binary `{}` already exists in destination", name)) + .map(|(name, _)| { + format!( + "binary `{}` already exists in destination `{}`", + name, + dst.join(name).to_string_lossy() + ) + }) .collect(); msg.push("Add --force to overwrite".to_string()); bail!("{}", msg.join("\n")); diff --git a/tests/testsuite/install_upgrade.rs b/tests/testsuite/install_upgrade.rs index 296d21c4fed..82e93e3b253 100644 --- a/tests/testsuite/install_upgrade.rs +++ b/tests/testsuite/install_upgrade.rs @@ -694,7 +694,7 @@ fn no_track() { .with_stderr( "\ [UPDATING] `[..]` index -[ERROR] binary `foo[EXE]` already exists in destination +[ERROR] binary `foo[EXE]` already exists in destination `[..]/.cargo/bin/foo` Add --force to overwrite ", ) From 774ccc39a57ead770dbf487c6a3dd5f434a70374 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 31 Aug 2021 16:54:16 +0800 Subject: [PATCH 2/2] Make windows CI happy Signed-off-by: hi-rustin --- tests/testsuite/install_upgrade.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testsuite/install_upgrade.rs b/tests/testsuite/install_upgrade.rs index 82e93e3b253..1a18bc211e7 100644 --- a/tests/testsuite/install_upgrade.rs +++ b/tests/testsuite/install_upgrade.rs @@ -694,7 +694,7 @@ fn no_track() { .with_stderr( "\ [UPDATING] `[..]` index -[ERROR] binary `foo[EXE]` already exists in destination `[..]/.cargo/bin/foo` +[ERROR] binary `foo[EXE]` already exists in destination `[..]/.cargo/bin/foo[EXE]` Add --force to overwrite ", )