diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-17 11:17:46 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-17 11:17:46 +0000 |
commit | 168c46ab777f6e3263bb2e58f0ce9b0b1619114e (patch) | |
tree | 0723f5b15899902811d027587a46698016d21d54 /crates/ra_ide_api | |
parent | 454cc313589fb17de92d6f3dbf576a5ea5f4adf2 (diff) | |
parent | a2ca03d10b093ea20d7db8bfd78aa1e787482cc0 (diff) |
Merge #561
561: :arrow_up: salsa r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/db.rs | 19 | ||||
-rw-r--r-- | crates/ra_ide_api/src/imp.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_api/src/symbol_index.rs | 21 |
5 files changed, 27 insertions, 29 deletions
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" | |||
10 | relative-path = "0.4.0" | 10 | relative-path = "0.4.0" |
11 | rayon = "1.0.2" | 11 | rayon = "1.0.2" |
12 | fst = "0.3.1" | 12 | fst = "0.3.1" |
13 | salsa = "0.9.2" | ||
14 | rustc-hash = "1.0" | 13 | rustc-hash = "1.0" |
15 | parking_lot = "0.7.0" | 14 | parking_lot = "0.7.0" |
16 | unicase = "2.2.0" | 15 | unicase = "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 @@ | |||
1 | use std::{fmt, sync::Arc}; | 1 | use std::{fmt, sync::Arc}; |
2 | 2 | ||
3 | use salsa::{self, Database}; | 3 | use ra_db::{ |
4 | use ra_db::{LocationIntener, BaseDatabase, FileId, Canceled}; | 4 | LocationIntener, BaseDatabase, FileId, Canceled, |
5 | salsa::{self, Database}, | ||
6 | }; | ||
5 | 7 | ||
6 | use crate::{symbol_index, LineIndex}; | 8 | use 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 | ||
76 | salsa::query_group! { | 78 | #[salsa::query_group] |
77 | pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + BaseDatabase { | 79 | pub(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 | ||
84 | fn line_index(db: &impl ra_db::FilesDatabase, file_id: FileId) -> Arc<LineIndex> { | 83 | fn 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 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use salsa::Database; | ||
4 | |||
5 | use hir::{ | 3 | use hir::{ |
6 | self, Problem, source_binder, | 4 | self, Problem, source_binder, |
7 | }; | 5 | }; |
8 | use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; | 6 | use ra_db::{ |
7 | FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase, | ||
8 | salsa::{self, Database}, | ||
9 | }; | ||
9 | use ra_ide_api_light::{self, assists, LocalEdit, Severity}; | 10 | use ra_ide_api_light::{self, assists, LocalEdit, Severity}; |
10 | use ra_syntax::{ | 11 | use 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 | ||
29 | use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit}; | 29 | use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit}; |
30 | use ra_text_edit::TextEdit; | 30 | use ra_text_edit::TextEdit; |
31 | use ra_db::{SyntaxDatabase, FilesDatabase, BaseDatabase}; | 31 | use ra_db::{ |
32 | SyntaxDatabase, FilesDatabase, BaseDatabase, | ||
33 | salsa::{self, ParallelDatabase}, | ||
34 | }; | ||
32 | use rayon::prelude::*; | 35 | use rayon::prelude::*; |
33 | use relative_path::RelativePathBuf; | 36 | use relative_path::RelativePathBuf; |
34 | use rustc_hash::FxHashMap; | 37 | use rustc_hash::FxHashMap; |
35 | use salsa::ParallelDatabase; | ||
36 | 38 | ||
37 | use crate::{ | 39 | use 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 | }; |
35 | use ra_db::{SourceRootId, FilesDatabase, LocalSyntaxPtr}; | 35 | use ra_db::{ |
36 | use salsa::ParallelDatabase; | 36 | SourceRootId, FilesDatabase, LocalSyntaxPtr, |
37 | salsa::{self, ParallelDatabase}, | ||
38 | }; | ||
37 | use rayon::prelude::*; | 39 | use rayon::prelude::*; |
38 | 40 | ||
39 | use crate::{ | 41 | use crate::{ |
@@ -41,16 +43,11 @@ use crate::{ | |||
41 | db::RootDatabase, | 43 | db::RootDatabase, |
42 | }; | 44 | }; |
43 | 45 | ||
44 | salsa::query_group! { | 46 | #[salsa::query_group] |
45 | pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { | 47 | pub(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 | ||
56 | fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { | 53 | fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { |