aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/db.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 21:04:42 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 21:04:42 +0100
commitb863272899a1bae63c7d9411d0ebff74652bae8e (patch)
treef5b95ae6af1ee37545eff70813c8940979e99daf /crates/ra_hir/src/db.rs
parentcc284dad30de4990516eeccf60f24e613fd78a2a (diff)
parent88189c428242d2d65b749d0980eb447e72766e77 (diff)
Merge #1126
1126: Swithc to native salsa interning r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r--crates/ra_hir/src/db.rs26
1 files changed, 22 insertions, 4 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index be8a8c98b..e23e2bb2b 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -1,10 +1,10 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; 3use ra_syntax::{SyntaxNode, TreeArc, SourceFile, ast};
4use ra_db::{SourceDatabase, salsa}; 4use ra_db::{SourceDatabase, salsa};
5 5
6use crate::{ 6use crate::{
7 HirFileId, MacroDefId, AstIdMap, ErasedFileAstId, Crate, Module, HirInterner, 7 HirFileId, MacroDefId, AstIdMap, ErasedFileAstId, Crate, Module, MacroCallLoc,
8 Function, FnSignature, ExprScopes, TypeAlias, 8 Function, FnSignature, ExprScopes, TypeAlias,
9 Struct, Enum, StructField, 9 Struct, Enum, StructField,
10 Const, ConstSignature, Static, 10 Const, ConstSignature, Static,
@@ -15,11 +15,29 @@ use crate::{
15 impl_block::{ModuleImplBlocks, ImplSourceMap}, 15 impl_block::{ModuleImplBlocks, ImplSourceMap},
16 generics::{GenericParams, GenericDef}, 16 generics::{GenericParams, GenericDef},
17 type_ref::TypeRef, 17 type_ref::TypeRef,
18 traits::TraitData, Trait, ty::TraitRef 18 traits::TraitData, Trait, ty::TraitRef,
19 ids
19}; 20};
20 21
21#[salsa::query_group(DefDatabaseStorage)] 22#[salsa::query_group(DefDatabaseStorage)]
22pub trait DefDatabase: SourceDatabase + AsRef<HirInterner> { 23pub trait DefDatabase: SourceDatabase {
24 #[salsa::interned]
25 fn intern_macro(&self, macro_call: MacroCallLoc) -> ids::MacroCallId;
26 #[salsa::interned]
27 fn intern_function(&self, loc: ids::ItemLoc<ast::FnDef>) -> ids::FunctionId;
28 #[salsa::interned]
29 fn intern_struct(&self, loc: ids::ItemLoc<ast::StructDef>) -> ids::StructId;
30 #[salsa::interned]
31 fn intern_enum(&self, loc: ids::ItemLoc<ast::EnumDef>) -> ids::EnumId;
32 #[salsa::interned]
33 fn intern_const(&self, loc: ids::ItemLoc<ast::ConstDef>) -> ids::ConstId;
34 #[salsa::interned]
35 fn intern_static(&self, loc: ids::ItemLoc<ast::StaticDef>) -> ids::StaticId;
36 #[salsa::interned]
37 fn intern_trait(&self, loc: ids::ItemLoc<ast::TraitDef>) -> ids::TraitId;
38 #[salsa::interned]
39 fn intern_type_alias(&self, loc: ids::ItemLoc<ast::TypeAliasDef>) -> ids::TypeAliasId;
40
23 #[salsa::invoke(crate::ids::macro_def_query)] 41 #[salsa::invoke(crate::ids::macro_def_query)]
24 fn macro_def(&self, macro_id: MacroDefId) -> Option<Arc<mbe::MacroRules>>; 42 fn macro_def(&self, macro_id: MacroDefId) -> Option<Arc<mbe::MacroRules>>;
25 43