From d0d1a202d4a4c56e593611aa34ef2e39255d16d2 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 25 Sep 2019 20:01:02 +0200 Subject: Fix retrieval of the Fn traits I used the wrong query, so it only used the lang items from the respective crate... --- crates/ra_hir/src/db.rs | 4 ++-- crates/ra_hir/src/lang_item.rs | 4 ++-- crates/ra_hir/src/ty/traits/chalk.rs | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir/src') 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 { #[salsa::invoke(crate::lang_item::LangItems::module_lang_items_query)] fn module_lang_items(&self, module: Module) -> Option>; - #[salsa::invoke(crate::lang_item::LangItems::lang_items_query)] - fn lang_items(&self, krate: Crate) -> Arc; + #[salsa::invoke(crate::lang_item::LangItems::crate_lang_items_query)] + fn crate_lang_items(&self, krate: Crate) -> Arc; #[salsa::invoke(crate::lang_item::LangItems::lang_item_query)] fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option; 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 { } /// Salsa query. This will look for lang items in a specific crate. - pub(crate) fn lang_items_query( + pub(crate) fn crate_lang_items_query( db: &(impl DefDatabase + AstDatabase), krate: Crate, ) -> Arc { @@ -75,7 +75,7 @@ impl LangItems { start_crate: Crate, item: SmolStr, ) -> Option { - let lang_items = db.lang_items(start_crate); + let lang_items = db.crate_lang_items(start_crate); let start_crate_target = lang_items.items.get(&item); if let Some(target) = start_crate_target { 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( } fn get_fn_trait(db: &impl HirDatabase, krate: Crate, fn_trait: super::FnTrait) -> Option { - let lang_items = db.lang_items(krate); - let target = lang_items.target(fn_trait.lang_item_name())?; + let target = db.lang_item(krate, fn_trait.lang_item_name().into())?; match target { - crate::lang_item::LangItemTarget::Trait(t) => Some(*t), + crate::lang_item::LangItemTarget::Trait(t) => Some(t), _ => None, } } -- cgit v1.2.3