about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-12 07:30:26 +0000
committerbors <bors@rust-lang.org>2024-10-12 07:30:26 +0000
commit7562b175e35cd4f838fc623b15dda2b9cb5555c0 (patch)
treeb3af065c7a4f0c61abd787b763ca1f3f6ce30354
parentee7c8b9a90921928458b46e48a95b7b5f0a4ed7b (diff)
parent0865296a277c2248e90c69f19eb84c1d8442f161 (diff)
downloadrust-7562b175e35cd4f838fc623b15dda2b9cb5555c0.tar.gz
rust-7562b175e35cd4f838fc623b15dda2b9cb5555c0.zip
Auto merge of #18289 - darichey:fix-relative-buildfiles, r=lnicola
Fix panic when json project has relative buildfile paths

The `build_file` path may be relative to the workspace root.
-rw-r--r--src/tools/rust-analyzer/crates/project-model/src/workspace.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs
index 71b9b61e205..d1ee579c0d8 100644
--- a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs
+++ b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs
@@ -553,7 +553,7 @@ impl ProjectWorkspace {
             ProjectWorkspaceKind::Json(project) => project
                 .crates()
                 .filter_map(|(_, krate)| krate.build.as_ref().map(|build| build.build_file.clone()))
-                .map(AbsPathBuf::assert)
+                .map(|build_file| self.workspace_root().join(build_file))
                 .collect(),
             _ => vec![],
         }