diff options
author | Daniel McNab <[email protected]> | 2021-03-07 11:17:14 +0000 |
---|---|---|
committer | Daniel McNab <[email protected]> | 2021-03-07 11:17:14 +0000 |
commit | 71a254c1a1b8836db09dfd18a781c1a4215366fc (patch) | |
tree | b209600ed39fa32244a2cabe58ad1e6a7305ac10 /crates/project_model/src | |
parent | b46605cfcd0cee5875a534371ee9b7ab648cd286 (diff) |
Don't double analyse the same crate
Diffstat (limited to 'crates/project_model/src')
-rw-r--r-- | crates/project_model/src/workspace.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs index 695fac398..cacf462cf 100644 --- a/crates/project_model/src/workspace.rs +++ b/crates/project_model/src/workspace.rs | |||
@@ -453,6 +453,9 @@ fn cargo_to_crate_graph( | |||
453 | let mut queue = VecDeque::new(); | 453 | let mut queue = VecDeque::new(); |
454 | queue.push_back(root_pkg); | 454 | queue.push_back(root_pkg); |
455 | while let Some(pkg) = queue.pop_front() { | 455 | while let Some(pkg) = queue.pop_front() { |
456 | if rustc_pkg_crates.contains_key(&pkg) { | ||
457 | continue; | ||
458 | } | ||
456 | for dep in &rustc_workspace[pkg].dependencies { | 459 | for dep in &rustc_workspace[pkg].dependencies { |
457 | queue.push_back(dep.pkg); | 460 | queue.push_back(dep.pkg); |
458 | } | 461 | } |
@@ -481,7 +484,7 @@ fn cargo_to_crate_graph( | |||
481 | } | 484 | } |
482 | // Now add a dep edge from all targets of upstream to the lib | 485 | // Now add a dep edge from all targets of upstream to the lib |
483 | // target of downstream. | 486 | // target of downstream. |
484 | for pkg in rustc_workspace.packages() { | 487 | for pkg in rustc_pkg_crates.keys().copied() { |
485 | for dep in rustc_workspace[pkg].dependencies.iter() { | 488 | for dep in rustc_workspace[pkg].dependencies.iter() { |
486 | let name = CrateName::new(&dep.name).unwrap(); | 489 | let name = CrateName::new(&dep.name).unwrap(); |
487 | if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { | 490 | if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { |
@@ -519,6 +522,8 @@ fn cargo_to_crate_graph( | |||
519 | } | 522 | } |
520 | } | 523 | } |
521 | } | 524 | } |
525 | } else { | ||
526 | eprintln!("No cargo workspace"); | ||
522 | } | 527 | } |
523 | crate_graph | 528 | crate_graph |
524 | } | 529 | } |