aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_db/Cargo.toml2
-rw-r--r--crates/ra_db/src/input.rs65
-rw-r--r--crates/ra_db/src/lib.rs10
-rw-r--r--crates/ra_hir/Cargo.toml1
-rw-r--r--crates/ra_hir/src/db.rs174
-rw-r--r--crates/ra_hir/src/mock.rs10
-rw-r--r--crates/ra_hir/src/nameres/tests.rs3
-rw-r--r--crates/ra_hir/src/ty/tests.rs4
-rw-r--r--crates/ra_ide_api/Cargo.toml1
-rw-r--r--crates/ra_ide_api/src/db.rs19
-rw-r--r--crates/ra_ide_api/src/imp.rs9
-rw-r--r--crates/ra_ide_api/src/lib.rs6
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs21
13 files changed, 135 insertions, 190 deletions
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml
index 21d987688..bb1b5eae7 100644
--- a/crates/ra_db/Cargo.toml
+++ b/crates/ra_db/Cargo.toml
@@ -6,7 +6,7 @@ authors = ["Aleksey Kladov <[email protected]>"]
6 6
7[dependencies] 7[dependencies]
8relative-path = "0.4.0" 8relative-path = "0.4.0"
9salsa = "0.9.2" 9salsa = "0.10.0-alpha1"
10rustc-hash = "1.0" 10rustc-hash = "1.0"
11parking_lot = "0.7.0" 11parking_lot = "0.7.0"
12ra_arena = { path = "../ra_arena" } 12ra_arena = { path = "../ra_arena" }
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index 2b761ea0c..b5d63e820 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -146,46 +146,31 @@ impl CrateGraph {
146 } 146 }
147} 147}
148 148
149salsa::query_group! { 149#[salsa::query_group]
150 pub trait FilesDatabase: salsa::Database { 150pub trait FilesDatabase: salsa::Database {
151 /// Text of the file. 151 /// Text of the file.
152 fn file_text(file_id: FileId) -> Arc<String> { 152 #[salsa::input]
153 type FileTextQuery; 153 fn file_text(&self, file_id: FileId) -> Arc<String>;
154 storage input; 154 /// Path to a file, relative to the root of its source root.
155 } 155 #[salsa::input]
156 /// Path to a file, relative to the root of its source root. 156 fn file_relative_path(&self, file_id: FileId) -> RelativePathBuf;
157 fn file_relative_path(file_id: FileId) -> RelativePathBuf { 157 /// Source root of the file.
158 type FileRelativePathQuery; 158 #[salsa::input]
159 storage input; 159 fn file_source_root(&self, file_id: FileId) -> SourceRootId;
160 } 160 /// Contents of the source root.
161 /// Source root of the file. 161 #[salsa::input]
162 fn file_source_root(file_id: FileId) -> SourceRootId { 162 fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;
163 type FileSourceRootQuery; 163 /// The set of "local" (that is, from the current workspace) roots.
164 storage input; 164 /// Files in local roots are assumed to change frequently.
165 } 165 #[salsa::input]
166 /// Contents of the source root. 166 fn local_roots(&self) -> Arc<Vec<SourceRootId>>;
167 fn source_root(id: SourceRootId) -> Arc<SourceRoot> { 167 /// The set of roots for crates.io libraries.
168 type SourceRootQuery; 168 /// Files in libraries are assumed to never change.
169 storage input; 169 #[salsa::input]
170 } 170 fn library_roots(&self) -> Arc<Vec<SourceRootId>>;
171 /// The set of "local" (that is, from the current workspace) roots. 171 /// The crate graph.
172 /// Files in local roots are assumed to change frequently. 172 #[salsa::input]
173 fn local_roots() -> Arc<Vec<SourceRootId>> { 173 fn crate_graph(&self) -> Arc<CrateGraph>;
174 type LocalRootsQuery;
175 storage input;
176 }
177 /// The set of roots for crates.io libraries.
178 /// Files in libraries are assumed to never change.
179 fn library_roots() -> Arc<Vec<SourceRootId>> {
180 type LibraryRootsQuery;
181 storage input;
182 }
183 /// The crate graph.
184 fn crate_graph() -> Arc<CrateGraph> {
185 type CrateGraphQuery;
186 storage input;
187 }
188 }
189} 174}
190 175
191#[cfg(test)] 176#[cfg(test)]
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index 89113e7a6..dbeb9ec71 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -9,6 +9,7 @@ use std::panic;
9 9
10use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc}; 10use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc};
11 11
12pub use ::salsa as salsa;
12pub use crate::{ 13pub use crate::{
13 cancellation::Canceled, 14 cancellation::Canceled,
14 syntax_ptr::LocalSyntaxPtr, 15 syntax_ptr::LocalSyntaxPtr,
@@ -51,12 +52,9 @@ pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe {
51 } 52 }
52} 53}
53 54
54salsa::query_group! { 55#[salsa::query_group]
55 pub trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase { 56pub trait SyntaxDatabase: crate::input::FilesDatabase + BaseDatabase {
56 fn source_file(file_id: FileId) -> TreeArc<SourceFile> { 57 fn source_file(&self, file_id: FileId) -> TreeArc<SourceFile>;
57 type SourceFileQuery;
58 }
59 }
60} 58}
61 59
62fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreeArc<SourceFile> { 60fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreeArc<SourceFile> {
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml
index 415848f09..87d2e98e9 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/ra_hir/Cargo.toml
@@ -8,7 +8,6 @@ authors = ["Aleksey Kladov <[email protected]>"]
8arrayvec = "0.4.10" 8arrayvec = "0.4.10"
9log = "0.4.5" 9log = "0.4.5"
10relative-path = "0.4.0" 10relative-path = "0.4.0"
11salsa = "0.9.2"
12rustc-hash = "1.0" 11rustc-hash = "1.0"
13parking_lot = "0.7.0" 12parking_lot = "0.7.0"
14ena = "0.11" 13ena = "0.11"
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 0a0994f5f..b42f10071 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -1,7 +1,7 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; 3use ra_syntax::{SyntaxNode, TreeArc, SourceFile};
4use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase}; 4use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, salsa};
5 5
6use crate::{ 6use crate::{
7 DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId, 7 DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId,
@@ -16,111 +16,77 @@ use crate::{
16 impl_block::ModuleImplBlocks, 16 impl_block::ModuleImplBlocks,
17}; 17};
18 18
19salsa::query_group! { 19#[salsa::query_group]
20 20pub trait HirDatabase:
21pub trait HirDatabase: SyntaxDatabase 21 SyntaxDatabase
22 + AsRef<LocationIntener<DefLoc, DefId>> 22 + AsRef<LocationIntener<DefLoc, DefId>>
23 + AsRef<LocationIntener<MacroCallLoc, MacroCallId>> 23 + AsRef<LocationIntener<MacroCallLoc, MacroCallId>>
24{ 24{
25 fn hir_source_file(file_id: HirFileId) -> TreeArc<SourceFile> { 25 #[salsa::invoke(HirFileId::hir_source_file)]
26 type HirSourceFileQuery; 26 fn hir_source_file(&self, file_id: HirFileId) -> TreeArc<SourceFile>;
27 use fn HirFileId::hir_source_file; 27
28 } 28 #[salsa::invoke(crate::macros::expand_macro_invocation)]
29 29 fn expand_macro_invocation(&self, invoc: MacroCallId) -> Option<Arc<MacroExpansion>>;
30 fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> { 30
31 type ExpandMacroCallQuery; 31 #[salsa::invoke(query_definitions::fn_scopes)]
32 use fn crate::macros::expand_macro_invocation; 32 fn fn_scopes(&self, def_id: DefId) -> Arc<FnScopes>;
33 } 33
34 34 #[salsa::invoke(crate::adt::StructData::struct_data_query)]
35 fn fn_scopes(def_id: DefId) -> Arc<FnScopes> { 35 fn struct_data(&self, def_id: DefId) -> Arc<StructData>;
36 type FnScopesQuery; 36
37 use fn query_definitions::fn_scopes; 37 #[salsa::invoke(crate::adt::EnumData::enum_data_query)]
38 } 38 fn enum_data(&self, def_id: DefId) -> Arc<EnumData>;
39 39
40 fn struct_data(def_id: DefId) -> Arc<StructData> { 40 #[salsa::invoke(crate::adt::EnumVariantData::enum_variant_data_query)]
41 type StructDataQuery; 41 fn enum_variant_data(&self, def_id: DefId) -> Arc<EnumVariantData>;
42 use fn crate::adt::StructData::struct_data_query; 42
43 } 43 #[salsa::invoke(crate::ty::infer)]
44 44 fn infer(&self, def_id: DefId) -> Arc<InferenceResult>;
45 fn enum_data(def_id: DefId) -> Arc<EnumData> { 45
46 type EnumDataQuery; 46 #[salsa::invoke(crate::ty::type_for_def)]
47 use fn crate::adt::EnumData::enum_data_query; 47 fn type_for_def(&self, def_id: DefId) -> Ty;
48 } 48
49 49 #[salsa::invoke(crate::ty::type_for_field)]
50 fn enum_variant_data(def_id: DefId) -> Arc<EnumVariantData> { 50 fn type_for_field(&self, def_id: DefId, field: Name) -> Option<Ty>;
51 type EnumVariantDataQuery; 51
52 use fn crate::adt::EnumVariantData::enum_variant_data_query; 52 #[salsa::invoke(query_definitions::file_items)]
53 } 53 fn file_items(&self, file_id: HirFileId) -> Arc<SourceFileItems>;
54 54
55 fn infer(def_id: DefId) -> Arc<InferenceResult> { 55 #[salsa::invoke(query_definitions::file_item)]
56 type InferQuery; 56 fn file_item(&self, source_item_id: SourceItemId) -> TreeArc<SyntaxNode>;
57 use fn crate::ty::infer; 57
58 } 58 #[salsa::invoke(crate::module_tree::Submodule::submodules_query)]
59 59 fn submodules(&self, source: SourceItemId) -> Arc<Vec<crate::module_tree::Submodule>>;
60 fn type_for_def(def_id: DefId) -> Ty { 60
61 type TypeForDefQuery; 61 #[salsa::invoke(query_definitions::input_module_items)]
62 use fn crate::ty::type_for_def; 62 fn input_module_items(
63 } 63 &self,
64 64 source_root_id: SourceRootId,
65 fn type_for_field(def_id: DefId, field: Name) -> Option<Ty> { 65 module_id: ModuleId,
66 type TypeForFieldQuery; 66 ) -> Arc<InputModuleItems>;
67 use fn crate::ty::type_for_field; 67
68 } 68 #[salsa::invoke(query_definitions::item_map)]
69 69 fn item_map(&self, source_root_id: SourceRootId) -> Arc<ItemMap>;
70 fn file_items(file_id: HirFileId) -> Arc<SourceFileItems> { 70
71 type SourceFileItemsQuery; 71 #[salsa::invoke(crate::module_tree::ModuleTree::module_tree_query)]
72 use fn query_definitions::file_items; 72 fn module_tree(&self, source_root_id: SourceRootId) -> Arc<ModuleTree>;
73 } 73
74 74 #[salsa::invoke(crate::impl_block::impls_in_module)]
75 fn file_item(source_item_id: SourceItemId) -> TreeArc<SyntaxNode> { 75 fn impls_in_module(
76 type FileItemQuery; 76 &self,
77 use fn query_definitions::file_item; 77 source_root_id: SourceRootId,
78 } 78 module_id: ModuleId,
79 79 ) -> Arc<ModuleImplBlocks>;
80 fn submodules(source: SourceItemId) -> Arc<Vec<crate::module_tree::Submodule>> { 80
81 type SubmodulesQuery; 81 #[salsa::invoke(crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query)]
82 use fn crate::module_tree::Submodule::submodules_query; 82 fn impls_in_crate(&self, krate: Crate) -> Arc<CrateImplBlocks>;
83 } 83
84 84 #[salsa::invoke(crate::expr::body_hir)]
85 fn input_module_items(source_root_id: SourceRootId, module_id: ModuleId) -> Arc<InputModuleItems> { 85 fn body_hir(&self, def_id: DefId) -> Arc<crate::expr::Body>;
86 type InputModuleItemsQuery; 86
87 use fn query_definitions::input_module_items; 87 #[salsa::invoke(crate::expr::body_syntax_mapping)]
88 } 88 fn body_syntax_mapping(&self, def_id: DefId) -> Arc<crate::expr::BodySyntaxMapping>;
89
90 fn item_map(source_root_id: SourceRootId) -> Arc<ItemMap> {
91 type ItemMapQuery;
92 use fn query_definitions::item_map;
93 }
94
95 fn module_tree(source_root_id: SourceRootId) -> Arc<ModuleTree> {
96 type ModuleTreeQuery;
97 use fn crate::module_tree::ModuleTree::module_tree_query;
98 }
99
100 fn impls_in_module(source_root_id: SourceRootId, module_id: ModuleId) -> Arc<ModuleImplBlocks> {
101 type ImplsInModuleQuery;
102 use fn crate::impl_block::impls_in_module;
103 }
104
105 fn impls_in_crate(krate: Crate) -> Arc<CrateImplBlocks> {
106 type ImplsInCrateQuery;
107 use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query;
108 }
109
110 fn body_hir(def_id: DefId) -> Arc<crate::expr::Body> {
111 type BodyHirQuery;
112 use fn crate::expr::body_hir;
113 }
114
115 fn body_syntax_mapping(def_id: DefId) -> Arc<crate::expr::BodySyntaxMapping> {
116 type BodySyntaxMappingQuery;
117 use fn crate::expr::body_syntax_mapping;
118 }
119
120 fn fn_signature(def_id: DefId) -> Arc<FnSignature> {
121 type FnSignatureQuery;
122 use fn crate::FnSignature::fn_signature_query;
123 }
124}
125 89
90 #[salsa::invoke(crate::FnSignature::fn_signature_query)]
91 fn fn_signature(&self, def_id: DefId) -> Arc<FnSignature>;
126} 92}
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index 9371c5a0d..a83a5c6cc 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -1,8 +1,10 @@
1use std::{sync::Arc, panic}; 1use std::{sync::Arc, panic};
2 2
3use parking_lot::Mutex; 3use parking_lot::Mutex;
4use salsa::{self, Database}; 4use ra_db::{
5use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId}; 5 LocationIntener, BaseDatabase, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId,
6 salsa::{self, Database},
7};
6use relative_path::RelativePathBuf; 8use relative_path::RelativePathBuf;
7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; 9use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
8 10
@@ -220,10 +222,10 @@ salsa::database_storage! {
220 } 222 }
221 impl db::HirDatabase { 223 impl db::HirDatabase {
222 fn hir_source_file() for db::HirSourceFileQuery; 224 fn hir_source_file() for db::HirSourceFileQuery;
223 fn expand_macro_invocation() for db::ExpandMacroCallQuery; 225 fn expand_macro_invocation() for db::ExpandMacroInvocationQuery;
224 fn module_tree() for db::ModuleTreeQuery; 226 fn module_tree() for db::ModuleTreeQuery;
225 fn fn_scopes() for db::FnScopesQuery; 227 fn fn_scopes() for db::FnScopesQuery;
226 fn file_items() for db::SourceFileItemsQuery; 228 fn file_items() for db::FileItemsQuery;
227 fn file_item() for db::FileItemQuery; 229 fn file_item() for db::FileItemQuery;
228 fn input_module_items() for db::InputModuleItemsQuery; 230 fn input_module_items() for db::InputModuleItemsQuery;
229 fn item_map() for db::ItemMapQuery; 231 fn item_map() for db::ItemMapQuery;
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index 9a0474045..0ec11ec12 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -1,7 +1,6 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use salsa::Database; 3use ra_db::{FilesDatabase, CrateGraph, SourceRootId, salsa::Database};
4use ra_db::{FilesDatabase, CrateGraph, SourceRootId};
5use relative_path::RelativePath; 4use relative_path::RelativePath;
6use test_utils::assert_eq_text; 5use test_utils::assert_eq_text;
7 6
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index affd63a85..a430cbe88 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -3,9 +3,7 @@ use std::fmt::Write;
3use std::path::{PathBuf, Path}; 3use std::path::{PathBuf, Path};
4use std::fs; 4use std::fs;
5 5
6use salsa::Database; 6use ra_db::{SyntaxDatabase, salsa::Database};
7
8use ra_db::SyntaxDatabase;
9use ra_syntax::ast::{self, AstNode}; 7use ra_syntax::ast::{self, AstNode};
10use test_utils::{project_dir, assert_eq_text, read_text}; 8use test_utils::{project_dir, assert_eq_text, read_text};
11 9
diff --git a/crates/ra_ide_api/Cargo.toml b/crates/ra_ide_api/Cargo.toml
index 022cbd5a3..702c11932 100644
--- a/crates/ra_ide_api/Cargo.toml
+++ b/crates/ra_ide_api/Cargo.toml
@@ -10,7 +10,6 @@ log = "0.4.5"
10relative-path = "0.4.0" 10relative-path = "0.4.0"
11rayon = "1.0.2" 11rayon = "1.0.2"
12fst = "0.3.1" 12fst = "0.3.1"
13salsa = "0.9.2"
14rustc-hash = "1.0" 13rustc-hash = "1.0"
15parking_lot = "0.7.0" 14parking_lot = "0.7.0"
16unicase = "2.2.0" 15unicase = "2.2.0"
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index 60f84675d..36778b955 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -1,7 +1,9 @@
1use std::{fmt, sync::Arc}; 1use std::{fmt, sync::Arc};
2 2
3use salsa::{self, Database}; 3use ra_db::{
4use ra_db::{LocationIntener, BaseDatabase, FileId, Canceled}; 4 LocationIntener, BaseDatabase, FileId, Canceled,
5 salsa::{self, Database},
6};
5 7
6use crate::{symbol_index, LineIndex}; 8use crate::{symbol_index, LineIndex};
7 9
@@ -73,12 +75,9 @@ impl AsRef<LocationIntener<hir::MacroCallLoc, hir::MacroCallId>> for RootDatabas
73 } 75 }
74} 76}
75 77
76salsa::query_group! { 78#[salsa::query_group]
77 pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + BaseDatabase { 79pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + BaseDatabase {
78 fn line_index(file_id: FileId) -> Arc<LineIndex> { 80 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>;
79 type LineIndexQuery;
80 }
81 }
82} 81}
83 82
84fn line_index(db: &impl ra_db::FilesDatabase, file_id: FileId) -> Arc<LineIndex> { 83fn line_index(db: &impl ra_db::FilesDatabase, file_id: FileId) -> Arc<LineIndex> {
@@ -109,10 +108,10 @@ salsa::database_storage! {
109 } 108 }
110 impl hir::db::HirDatabase { 109 impl hir::db::HirDatabase {
111 fn hir_source_file() for hir::db::HirSourceFileQuery; 110 fn hir_source_file() for hir::db::HirSourceFileQuery;
112 fn expand_macro_invocation() for hir::db::ExpandMacroCallQuery; 111 fn expand_macro_invocation() for hir::db::ExpandMacroInvocationQuery;
113 fn module_tree() for hir::db::ModuleTreeQuery; 112 fn module_tree() for hir::db::ModuleTreeQuery;
114 fn fn_scopes() for hir::db::FnScopesQuery; 113 fn fn_scopes() for hir::db::FnScopesQuery;
115 fn file_items() for hir::db::SourceFileItemsQuery; 114 fn file_items() for hir::db::FileItemsQuery;
116 fn file_item() for hir::db::FileItemQuery; 115 fn file_item() for hir::db::FileItemQuery;
117 fn input_module_items() for hir::db::InputModuleItemsQuery; 116 fn input_module_items() for hir::db::InputModuleItemsQuery;
118 fn item_map() for hir::db::ItemMapQuery; 117 fn item_map() for hir::db::ItemMapQuery;
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index 61771ed40..28e497965 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -1,11 +1,12 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use salsa::Database;
4
5use hir::{ 3use hir::{
6 self, Problem, source_binder, 4 self, Problem, source_binder,
7}; 5};
8use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; 6use ra_db::{
7 FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase,
8 salsa::{self, Database},
9};
9use ra_ide_api_light::{self, assists, LocalEdit, Severity}; 10use ra_ide_api_light::{self, assists, LocalEdit, Severity};
10use ra_syntax::{ 11use ra_syntax::{
11 TextRange, AstNode, SourceFile, 12 TextRange, AstNode, SourceFile,
@@ -89,7 +90,7 @@ impl db::RootDatabase {
89 fn gc_syntax_trees(&mut self) { 90 fn gc_syntax_trees(&mut self) {
90 self.query(ra_db::SourceFileQuery) 91 self.query(ra_db::SourceFileQuery)
91 .sweep(salsa::SweepStrategy::default().discard_values()); 92 .sweep(salsa::SweepStrategy::default().discard_values());
92 self.query(hir::db::SourceFileItemsQuery) 93 self.query(hir::db::FileItemsQuery)
93 .sweep(salsa::SweepStrategy::default().discard_values()); 94 .sweep(salsa::SweepStrategy::default().discard_values());
94 self.query(hir::db::FileItemQuery) 95 self.query(hir::db::FileItemQuery)
95 .sweep(salsa::SweepStrategy::default().discard_values()); 96 .sweep(salsa::SweepStrategy::default().discard_values());
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 3a0d2dbbe..7b47d7b6d 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -28,11 +28,13 @@ use std::{fmt, sync::Arc};
28 28
29use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit}; 29use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit};
30use ra_text_edit::TextEdit; 30use ra_text_edit::TextEdit;
31use ra_db::{SyntaxDatabase, FilesDatabase, BaseDatabase}; 31use ra_db::{
32 SyntaxDatabase, FilesDatabase, BaseDatabase,
33 salsa::{self, ParallelDatabase},
34};
32use rayon::prelude::*; 35use rayon::prelude::*;
33use relative_path::RelativePathBuf; 36use relative_path::RelativePathBuf;
34use rustc_hash::FxHashMap; 37use rustc_hash::FxHashMap;
35use salsa::ParallelDatabase;
36 38
37use crate::{ 39use crate::{
38 symbol_index::{FileSymbol, SymbolIndex}, 40 symbol_index::{FileSymbol, SymbolIndex},
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 74165d68f..bfa2f3469 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -32,8 +32,10 @@ use ra_syntax::{
32 SyntaxKind::{self, *}, 32 SyntaxKind::{self, *},
33 ast::{self, NameOwner}, 33 ast::{self, NameOwner},
34}; 34};
35use ra_db::{SourceRootId, FilesDatabase, LocalSyntaxPtr}; 35use ra_db::{
36use salsa::ParallelDatabase; 36 SourceRootId, FilesDatabase, LocalSyntaxPtr,
37 salsa::{self, ParallelDatabase},
38};
37use rayon::prelude::*; 39use rayon::prelude::*;
38 40
39use crate::{ 41use crate::{
@@ -41,16 +43,11 @@ use crate::{
41 db::RootDatabase, 43 db::RootDatabase,
42}; 44};
43 45
44salsa::query_group! { 46#[salsa::query_group]
45 pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { 47pub(crate) trait SymbolsDatabase: hir::db::HirDatabase {
46 fn file_symbols(file_id: FileId) -> Arc<SymbolIndex> { 48 fn file_symbols(&self, file_id: FileId) -> Arc<SymbolIndex>;
47 type FileSymbolsQuery; 49 #[salsa::input]
48 } 50 fn library_symbols(&self, id: SourceRootId) -> Arc<SymbolIndex>;
49 fn library_symbols(id: SourceRootId) -> Arc<SymbolIndex> {
50 type LibrarySymbolsQuery;
51 storage input;
52 }
53 }
54} 51}
55 52
56fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { 53fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> {