mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Don't double analyse the same crate
This commit is contained in:
parent
b46605cfcd
commit
71a254c1a1
1 changed files with 6 additions and 1 deletions
|
@ -453,6 +453,9 @@ fn cargo_to_crate_graph(
|
||||||
let mut queue = VecDeque::new();
|
let mut queue = VecDeque::new();
|
||||||
queue.push_back(root_pkg);
|
queue.push_back(root_pkg);
|
||||||
while let Some(pkg) = queue.pop_front() {
|
while let Some(pkg) = queue.pop_front() {
|
||||||
|
if rustc_pkg_crates.contains_key(&pkg) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for dep in &rustc_workspace[pkg].dependencies {
|
for dep in &rustc_workspace[pkg].dependencies {
|
||||||
queue.push_back(dep.pkg);
|
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
|
// Now add a dep edge from all targets of upstream to the lib
|
||||||
// target of downstream.
|
// 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() {
|
for dep in rustc_workspace[pkg].dependencies.iter() {
|
||||||
let name = CrateName::new(&dep.name).unwrap();
|
let name = CrateName::new(&dep.name).unwrap();
|
||||||
if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) {
|
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
|
crate_graph
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue