aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/traits.rs')
-rw-r--r--crates/ra_hir/src/ty/traits.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index a91c2476b..637e21e9c 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -2,13 +2,13 @@
2use std::sync::{Arc, Mutex}; 2use std::sync::{Arc, Mutex};
3 3
4use chalk_ir::{cast::Cast, family::ChalkIr}; 4use chalk_ir::{cast::Cast, family::ChalkIr};
5use hir_def::{expr::ExprId, DefWithBodyId}; 5use hir_def::{expr::ExprId, DefWithBodyId, TraitId};
6use log::debug; 6use log::debug;
7use ra_db::{impl_intern_key, salsa}; 7use ra_db::{impl_intern_key, salsa, CrateId};
8use ra_prof::profile; 8use ra_prof::profile;
9use rustc_hash::FxHashSet; 9use rustc_hash::FxHashSet;
10 10
11use crate::{db::HirDatabase, Crate, ImplBlock, Trait, TypeAlias}; 11use crate::{db::HirDatabase, Crate, ImplBlock, TypeAlias};
12 12
13use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; 13use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk};
14 14
@@ -77,8 +77,8 @@ pub(crate) fn trait_solver_query(
77/// Collects impls for the given trait in the whole dependency tree of `krate`. 77/// Collects impls for the given trait in the whole dependency tree of `krate`.
78pub(crate) fn impls_for_trait_query( 78pub(crate) fn impls_for_trait_query(
79 db: &impl HirDatabase, 79 db: &impl HirDatabase,
80 krate: Crate, 80 krate: CrateId,
81 trait_: Trait, 81 trait_: TraitId,
82) -> Arc<[ImplBlock]> { 82) -> Arc<[ImplBlock]> {
83 let mut impls = FxHashSet::default(); 83 let mut impls = FxHashSet::default();
84 // We call the query recursively here. On the one hand, this means we can 84 // We call the query recursively here. On the one hand, this means we can
@@ -86,10 +86,10 @@ pub(crate) fn impls_for_trait_query(
86 // will only ever get called for a few crates near the root of the tree (the 86 // will only ever get called for a few crates near the root of the tree (the
87 // ones the user is editing), so this may actually be a waste of memory. I'm 87 // ones the user is editing), so this may actually be a waste of memory. I'm
88 // doing it like this mainly for simplicity for now. 88 // doing it like this mainly for simplicity for now.
89 for dep in krate.dependencies(db) { 89 for dep in db.crate_graph().dependencies(krate) {
90 impls.extend(db.impls_for_trait(dep.krate, trait_).iter()); 90 impls.extend(db.impls_for_trait(dep.crate_id, trait_).iter());
91 } 91 }
92 let crate_impl_blocks = db.impls_in_crate(krate.crate_id); 92 let crate_impl_blocks = db.impls_in_crate(krate);
93 impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(trait_).map(ImplBlock::from)); 93 impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(trait_).map(ImplBlock::from));
94 impls.into_iter().collect() 94 impls.into_iter().collect()
95} 95}