mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Deduplicate impls in impls_for_trait
This was duplicating impls in dependencies a lot...
This commit is contained in:
parent
880ef25a9e
commit
530b3047ed
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
//! Trait solving using Chalk.
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use rustc_hash::FxHashSet;
|
||||
use log::debug;
|
||||
use chalk_ir::cast::Cast;
|
||||
|
||||
|
@ -31,7 +32,7 @@ pub(crate) fn impls_for_trait(
|
|||
krate: Crate,
|
||||
trait_: Trait,
|
||||
) -> Arc<[ImplBlock]> {
|
||||
let mut impls = Vec::new();
|
||||
let mut impls = FxHashSet::default();
|
||||
// We call the query recursively here. On the one hand, this means we can
|
||||
// reuse results from queries for different crates; on the other hand, this
|
||||
// will only ever get called for a few crates near the root of the tree (the
|
||||
|
@ -42,7 +43,7 @@ pub(crate) fn impls_for_trait(
|
|||
}
|
||||
let crate_impl_blocks = db.impls_in_crate(krate);
|
||||
impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(&trait_));
|
||||
impls.into()
|
||||
impls.into_iter().collect::<Vec<_>>().into()
|
||||
}
|
||||
|
||||
fn solve(
|
||||
|
|
Loading…
Reference in a new issue