aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/db.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-24 20:08:10 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-24 20:08:10 +0000
commit61d961263387f7293f3d0c4d7b8c8c9a07959ced (patch)
treeb22232818d8d8ad8fff5b11b1656e2602115cd55 /crates/ra_hir/src/db.rs
parent5a684099e9aa3482b408002030fafe1dcd0fa9a9 (diff)
parentc3c09795614f31f988edc9cb051ce024d1996d89 (diff)
Merge #892
892: Type aliases r=matklad a=flodiebold This implements type aliases (i.e. `type` definitions). There's just one snag: handling recursion. E.g. `type Foo = Foo` makes type inference panic with a query cycle. I think the best way to handle this would be if Salsa provided the ability to catch cycle errors? It seems that there's some work underway to support this [here](https://github.com/salsa-rs/salsa/issues/6) and [here](https://github.com/salsa-rs/salsa/pull/147). Should we wait for this? I don't see a good way to handle this without help from Salsa. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r--crates/ra_hir/src/db.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index fc0ee068c..b8bd82f0c 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -15,7 +15,7 @@ use crate::{
15 adt::{StructData, EnumData}, 15 adt::{StructData, EnumData},
16 impl_block::{ModuleImplBlocks, ImplSourceMap}, 16 impl_block::{ModuleImplBlocks, ImplSourceMap},
17 generics::{GenericParams, GenericDef}, 17 generics::{GenericParams, GenericDef},
18 ids::SourceFileItemId, nameres::Namespace 18 ids::SourceFileItemId, nameres::Namespace, type_ref::TypeRef, code_model_api::Type
19}; 19};
20 20
21#[salsa::query_group(PersistentHirDatabaseStorage)] 21#[salsa::query_group(PersistentHirDatabaseStorage)]
@@ -77,6 +77,9 @@ pub trait PersistentHirDatabase: SourceDatabase + AsRef<HirInterner> {
77 77
78 #[salsa::invoke(crate::FnSignature::fn_signature_query)] 78 #[salsa::invoke(crate::FnSignature::fn_signature_query)]
79 fn fn_signature(&self, func: Function) -> Arc<FnSignature>; 79 fn fn_signature(&self, func: Function) -> Arc<FnSignature>;
80
81 #[salsa::invoke(crate::type_alias::type_alias_ref_query)]
82 fn type_alias_ref(&self, typ: Type) -> Arc<TypeRef>;
80} 83}
81 84
82#[salsa::query_group(HirDatabaseStorage)] 85#[salsa::query_group(HirDatabaseStorage)]