From bc98b43a05d4ac1c2977fbe151593c3d12e96c8d Mon Sep 17 00:00:00 2001 From: Adam Spofford <93943719+adamspofford-dfinity@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:05:09 -0700 Subject: [PATCH] fix: Fix cdylib crate name logic (#3926) --- src/dfx/src/lib/canister_info/rust.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dfx/src/lib/canister_info/rust.rs b/src/dfx/src/lib/canister_info/rust.rs index 82a9e753cc..a3b7266c26 100644 --- a/src/dfx/src/lib/canister_info/rust.rs +++ b/src/dfx/src/lib/canister_info/rust.rs @@ -63,7 +63,10 @@ impl CanisterInfoFactory for RustCanisterInfo { (format!("crate `{package}`"), package.clone()) }; let mut candidate_targets = package_info.targets.iter().filter(|x| { - x.name == crate_name && x.crate_types.iter().any(|c| c == "cdylib" || c == "bin") + x.crate_types.iter().any(|c| { + (c == "cdylib" && x.name == crate_name.replace('-', "_")) + || (c == "bin" && x.name == crate_name) + }) }); let Some(target) = candidate_targets.next() else { if let Some(wrong_type_crate) =