Don't recursively call impls_from_deps
It creates a big map and duplicates lots of impls that are then left lying around
This commit is contained in:
parent
63ea8f2af0
commit
07ba986db7
@ -72,13 +72,8 @@ impl CrateImplDefs {
|
||||
impls_by_trait: FxHashMap::default(),
|
||||
};
|
||||
|
||||
// For each dependency, calculate `impls_from_deps` recursively, then add its own
|
||||
// `impls_in_crate`.
|
||||
// As we might visit crates multiple times, `merge` has to deduplicate impls to avoid
|
||||
// wasting memory.
|
||||
for dep in &crate_graph[krate].dependencies {
|
||||
res.merge(&db.impls_from_deps(dep.crate_id));
|
||||
res.merge(&db.impls_in_crate(dep.crate_id));
|
||||
for krate in crate_graph.transitive_deps(krate) {
|
||||
res.merge(&db.impls_in_crate(krate));
|
||||
}
|
||||
|
||||
Arc::new(res)
|
||||
@ -114,8 +109,6 @@ impl CrateImplDefs {
|
||||
for (fp, impls) in &other.inherent_impls {
|
||||
let vec = self.inherent_impls.entry(*fp).or_default();
|
||||
vec.extend(impls);
|
||||
vec.sort();
|
||||
vec.dedup();
|
||||
}
|
||||
|
||||
for (trait_, other_map) in &other.impls_by_trait {
|
||||
@ -123,8 +116,6 @@ impl CrateImplDefs {
|
||||
for (fp, impls) in other_map {
|
||||
let vec = map.entry(*fp).or_default();
|
||||
vec.extend(impls);
|
||||
vec.sort();
|
||||
vec.dedup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user