Skip to content

Commit 71a254c

Browse files
committed
Don't double analyse the same crate
1 parent b46605c commit 71a254c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/project_model/src/workspace.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ fn cargo_to_crate_graph(
453453
let mut queue = VecDeque::new();
454454
queue.push_back(root_pkg);
455455
while let Some(pkg) = queue.pop_front() {
456+
if rustc_pkg_crates.contains_key(&pkg) {
457+
continue;
458+
}
456459
for dep in &rustc_workspace[pkg].dependencies {
457460
queue.push_back(dep.pkg);
458461
}
@@ -481,7 +484,7 @@ fn cargo_to_crate_graph(
481484
}
482485
// Now add a dep edge from all targets of upstream to the lib
483486
// target of downstream.
484-
for pkg in rustc_workspace.packages() {
487+
for pkg in rustc_pkg_crates.keys().copied() {
485488
for dep in rustc_workspace[pkg].dependencies.iter() {
486489
let name = CrateName::new(&dep.name).unwrap();
487490
if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) {
@@ -519,6 +522,8 @@ fn cargo_to_crate_graph(
519522
}
520523
}
521524
}
525+
} else {
526+
eprintln!("No cargo workspace");
522527
}
523528
crate_graph
524529
}

0 commit comments

Comments
 (0)