diff options
author | Edwin Cheng <[email protected]> | 2020-01-28 09:08:17 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-01-28 09:08:17 +0000 |
commit | c32be4bfe8c7fd176f620c193c86ab74fa9bdee7 (patch) | |
tree | 74b853b5290acd17960a55acf2ae880e7bd3d055 /crates/ra_project_model/src | |
parent | 912776fd9547d1d28b4cba7e4a41e5391fc12c21 (diff) |
Ignore illform node id from metadata
Diffstat (limited to 'crates/ra_project_model/src')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 20 |
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); |