aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-25 19:14:35 +0100
committerGitHub <[email protected]>2019-09-25 19:14:35 +0100
commit5704485063bad82e651c8e68f4fa2d333bfdf152 (patch)
treeb0928748d21ca45547e53701c6fc4d6d93a39c9a /crates/ra_hir/src
parenta452e50e0e89390b8a055f0c7c64100e9872edac (diff)
parentd0d1a202d4a4c56e593611aa34ef2e39255d16d2 (diff)
Merge #1913
1913: Fix retrieval of the Fn traits r=flodiebold a=flodiebold I used the wrong query, so it only used the lang items from the respective crate... Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/db.rs4
-rw-r--r--crates/ra_hir/src/lang_item.rs4
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs5
3 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 2b20ae02b..deed1c62f 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -136,8 +136,8 @@ pub trait DefDatabase: InternDatabase + HirDebugDatabase {
136 #[salsa::invoke(crate::lang_item::LangItems::module_lang_items_query)] 136 #[salsa::invoke(crate::lang_item::LangItems::module_lang_items_query)]
137 fn module_lang_items(&self, module: Module) -> Option<Arc<LangItems>>; 137 fn module_lang_items(&self, module: Module) -> Option<Arc<LangItems>>;
138 138
139 #[salsa::invoke(crate::lang_item::LangItems::lang_items_query)] 139 #[salsa::invoke(crate::lang_item::LangItems::crate_lang_items_query)]
140 fn lang_items(&self, krate: Crate) -> Arc<LangItems>; 140 fn crate_lang_items(&self, krate: Crate) -> Arc<LangItems>;
141 141
142 #[salsa::invoke(crate::lang_item::LangItems::lang_item_query)] 142 #[salsa::invoke(crate::lang_item::LangItems::lang_item_query)]
143 fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option<LangItemTarget>; 143 fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option<LangItemTarget>;
diff --git a/crates/ra_hir/src/lang_item.rs b/crates/ra_hir/src/lang_item.rs
index e3b71cec3..bcce314d8 100644
--- a/crates/ra_hir/src/lang_item.rs
+++ b/crates/ra_hir/src/lang_item.rs
@@ -42,7 +42,7 @@ impl LangItems {
42 } 42 }
43 43
44 /// Salsa query. This will look for lang items in a specific crate. 44 /// Salsa query. This will look for lang items in a specific crate.
45 pub(crate) fn lang_items_query( 45 pub(crate) fn crate_lang_items_query(
46 db: &(impl DefDatabase + AstDatabase), 46 db: &(impl DefDatabase + AstDatabase),
47 krate: Crate, 47 krate: Crate,
48 ) -> Arc<LangItems> { 48 ) -> Arc<LangItems> {
@@ -75,7 +75,7 @@ impl LangItems {
75 start_crate: Crate, 75 start_crate: Crate,
76 item: SmolStr, 76 item: SmolStr,
77 ) -> Option<LangItemTarget> { 77 ) -> Option<LangItemTarget> {
78 let lang_items = db.lang_items(start_crate); 78 let lang_items = db.crate_lang_items(start_crate);
79 let start_crate_target = lang_items.items.get(&item); 79 let start_crate_target = lang_items.items.get(&item);
80 if let Some(target) = start_crate_target { 80 if let Some(target) = start_crate_target {
81 Some(*target) 81 Some(*target)
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index d83706f86..538b4d3ec 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -765,10 +765,9 @@ fn closure_fn_trait_impl_datum(
765} 765}
766 766
767fn get_fn_trait(db: &impl HirDatabase, krate: Crate, fn_trait: super::FnTrait) -> Option<Trait> { 767fn get_fn_trait(db: &impl HirDatabase, krate: Crate, fn_trait: super::FnTrait) -> Option<Trait> {
768 let lang_items = db.lang_items(krate); 768 let target = db.lang_item(krate, fn_trait.lang_item_name().into())?;
769 let target = lang_items.target(fn_trait.lang_item_name())?;
770 match target { 769 match target {
771 crate::lang_item::LangItemTarget::Trait(t) => Some(*t), 770 crate::lang_item::LangItemTarget::Trait(t) => Some(t),
772 _ => None, 771 _ => None,
773 } 772 }
774} 773}