From 71a254c1a1b8836db09dfd18a781c1a4215366fc Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Sun, 7 Mar 2021 11:17:14 +0000 Subject: Don't double analyse the same crate --- crates/project_model/src/workspace.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates') 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( let mut queue = VecDeque::new(); queue.push_back(root_pkg); while let Some(pkg) = queue.pop_front() { + if rustc_pkg_crates.contains_key(&pkg) { + continue; + } for dep in &rustc_workspace[pkg].dependencies { queue.push_back(dep.pkg); } @@ -481,7 +484,7 @@ fn cargo_to_crate_graph( } // Now add a dep edge from all targets of upstream to the lib // target of downstream. - for pkg in rustc_workspace.packages() { + for pkg in rustc_pkg_crates.keys().copied() { for dep in rustc_workspace[pkg].dependencies.iter() { let name = CrateName::new(&dep.name).unwrap(); if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) { @@ -519,6 +522,8 @@ fn cargo_to_crate_graph( } } } + } else { + eprintln!("No cargo workspace"); } crate_graph } -- cgit v1.2.3