aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 1832c101f..66db2be51 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -207,9 +207,25 @@ impl CargoWorkspace {
207 } 207 }
208 let resolve = meta.resolve.expect("metadata executed with deps"); 208 let resolve = meta.resolve.expect("metadata executed with deps");
209 for node in resolve.nodes { 209 for node in resolve.nodes {
210 let source = pkg_by_id[&node.id]; 210 let source = match pkg_by_id.get(&node.id) {
211 Some(&src) => src,
212 None => {
213 log::error!("Node id do not match in cargo metadata, ignoring {}", node.id);
214 continue;
215 }
216 };
211 for dep_node in node.deps { 217 for dep_node in node.deps {
212 let dep = PackageDependency { name: dep_node.name, pkg: pkg_by_id[&dep_node.pkg] }; 218 let pkg = match pkg_by_id.get(&dep_node.pkg) {
219 Some(&pkg) => pkg,
220 None => {
221 log::error!(
222 "Dep node id do not match in cargo metadata, ignoring {}",
223 dep_node.pkg
224 );
225 continue;
226 }
227 };
228 let dep = PackageDependency { name: dep_node.name, pkg };
213 packages[source].dependencies.push(dep); 229 packages[source].dependencies.push(dep);
214 } 230 }
215 packages[source].features.extend(node.features); 231 packages[source].features.extend(node.features);