mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 04:23:25 +00:00
mark as visited on entry instead of left
This commit is contained in:
parent
0267df3815
commit
c0add813e9
1 changed files with 2 additions and 2 deletions
|
@ -118,9 +118,10 @@ impl CrateGraph {
|
||||||
self.arena[&crate_id].dependencies.iter()
|
self.arena[&crate_id].dependencies.iter()
|
||||||
}
|
}
|
||||||
fn dfs_find(&self, target: CrateId, from: CrateId, visited: &mut FxHashSet<CrateId>) -> bool {
|
fn dfs_find(&self, target: CrateId, from: CrateId, visited: &mut FxHashSet<CrateId>) -> bool {
|
||||||
if visited.contains(&from) {
|
if !visited.insert(from) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for dep in self.dependencies(from) {
|
for dep in self.dependencies(from) {
|
||||||
let crate_id = dep.crate_id();
|
let crate_id = dep.crate_id();
|
||||||
if crate_id == target {
|
if crate_id == target {
|
||||||
|
@ -131,7 +132,6 @@ impl CrateGraph {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visited.insert(from);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue