From 81b3d854980179af07f1fce3a36097085a124882 Mon Sep 17 00:00:00 2001 From: newfla Date: Sun, 9 Nov 2025 17:15:07 +0100 Subject: [PATCH 1/2] fix: avoid crashing when searching default members outside the main workspace folder --- packages/cli/src/workspace.rs | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/workspace.rs b/packages/cli/src/workspace.rs index 059addfd18..f06996a3aa 100644 --- a/packages/cli/src/workspace.rs +++ b/packages/cli/src/workspace.rs @@ -306,29 +306,29 @@ impl Workspace { if let Some(ws) = &self.cargo_toml.workspace { for default in &ws.default_members { let mut workspace_members = self.krates.workspace_members(); - let default_member_path = std::fs::canonicalize(default).unwrap(); - - let found = workspace_members.find_map(|node| { - if let krates::Node::Krate { id, krate, .. } = node { - // Skip this default member if it doesn't have any binary targets - if !krate - .targets - .iter() - .any(|t| t.kind.contains(&krates::cm::TargetKind::Bin)) - { - return None; - } - let member_path = - std::fs::canonicalize(krate.manifest_path.parent().unwrap()).unwrap(); - if member_path == default_member_path { - return Some(id); + if let Ok(default_member_path) = std::fs::canonicalize(default) { + let found = workspace_members.find_map(|node| { + if let krates::Node::Krate { id, krate, .. } = node { + // Skip this default member if it doesn't have any binary targets + if !krate + .targets + .iter() + .any(|t| t.kind.contains(&krates::cm::TargetKind::Bin)) + { + return None; + } + if std::fs::canonicalize(krate.manifest_path.parent().unwrap()) + .is_ok_and(|memeber_path| memeber_path == default_member_path) + { + return Some(id); + } } - } - None - }); + None + }); - if let Some(kid) = found { - return Ok(self.krates.nid_for_kid(kid).unwrap()); + if let Some(kid) = found { + return Ok(self.krates.nid_for_kid(kid).unwrap()); + } } } } From 9e1abed63d1aed5aff7af3112eb7a26ad6ba36f1 Mon Sep 17 00:00:00 2001 From: newfla Date: Mon, 10 Nov 2025 15:39:08 +0100 Subject: [PATCH 2/2] fix: typo correction --- packages/cli/src/workspace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/workspace.rs b/packages/cli/src/workspace.rs index f06996a3aa..be1ebb3f99 100644 --- a/packages/cli/src/workspace.rs +++ b/packages/cli/src/workspace.rs @@ -318,7 +318,7 @@ impl Workspace { return None; } if std::fs::canonicalize(krate.manifest_path.parent().unwrap()) - .is_ok_and(|memeber_path| memeber_path == default_member_path) + .is_ok_and(|member_path| member_path == default_member_path) { return Some(id); }