diff options
author | Kevin DeLorey <[email protected]> | 2020-02-09 16:25:47 +0000 |
---|---|---|
committer | Kevin DeLorey <[email protected]> | 2020-02-09 16:37:43 +0000 |
commit | a957c473fdb79880c39b73dc9e0c923093cf16ac (patch) | |
tree | f998b548f530ce604651e0e6af314ed2ec74b3b5 /crates/ra_project_model/src/cargo_workspace.rs | |
parent | 22caf982b99c54058e2e9200aeea0e61cada284a (diff) | |
parent | 1b9b13b4b4a75b5531c3f046ce6bf72d681f2732 (diff) |
Merge branch 'master' into kdelorey/complete-trait-impl
Diffstat (limited to 'crates/ra_project_model/src/cargo_workspace.rs')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 23 |
1 files changed, 21 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..60cb8c1eb 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -207,9 +207,28 @@ 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 | // FIXME: replace this and a similar branch below with `.unwrap`, once | ||
213 | // https://github.com/rust-lang/cargo/issues/7841 | ||
214 | // is fixed and hits stable (around 1.43-is probably?). | ||
215 | None => { | ||
216 | log::error!("Node id do not match in cargo metadata, ignoring {}", node.id); | ||
217 | continue; | ||
218 | } | ||
219 | }; | ||
211 | for dep_node in node.deps { | 220 | for dep_node in node.deps { |
212 | let dep = PackageDependency { name: dep_node.name, pkg: pkg_by_id[&dep_node.pkg] }; | 221 | let pkg = match pkg_by_id.get(&dep_node.pkg) { |
222 | Some(&pkg) => pkg, | ||
223 | None => { | ||
224 | log::error!( | ||
225 | "Dep node id do not match in cargo metadata, ignoring {}", | ||
226 | dep_node.pkg | ||
227 | ); | ||
228 | continue; | ||
229 | } | ||
230 | }; | ||
231 | let dep = PackageDependency { name: dep_node.name, pkg }; | ||
213 | packages[source].dependencies.push(dep); | 232 | packages[source].dependencies.push(dep); |
214 | } | 233 | } |
215 | packages[source].features.extend(node.features); | 234 | packages[source].features.extend(node.features); |