aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-07 09:14:48 +0100
committerAleksey Kladov <[email protected]>2020-07-07 09:14:48 +0100
commit4bbc385277bcab509c321b1374f72f1ef19d7750 (patch)
tree74488258fb566dc4344165ade6067d8f2ce7298f /crates/ra_db
parentd4bc2f25de6297c75f7b7f029df224b650ef3143 (diff)
Switch to fully dynamically dispatched salsa
This improves compile times quite a bit
Diffstat (limited to 'crates/ra_db')
-rw-r--r--crates/ra_db/Cargo.toml2
-rw-r--r--crates/ra_db/src/lib.rs7
2 files changed, 3 insertions, 6 deletions
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml
index 372fb242b..b2d481dfb 100644
--- a/crates/ra_db/Cargo.toml
+++ b/crates/ra_db/Cargo.toml
@@ -8,7 +8,7 @@ authors = ["rust-analyzer developers"]
8doctest = false 8doctest = false
9 9
10[dependencies] 10[dependencies]
11salsa = "0.14.1" 11salsa = { git = "https://github.com/nikomatsakis/salsa", branch = "dynamic-databases-rfc" }
12relative-path = "1.0.0" 12relative-path = "1.0.0"
13rustc-hash = "1.1.0" 13rustc-hash = "1.1.0"
14 14
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index 1ddacc1f6..590efffa4 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -113,7 +113,7 @@ pub trait SourceDatabase: CheckCanceled + FileLoader + std::fmt::Debug {
113 fn crate_graph(&self) -> Arc<CrateGraph>; 113 fn crate_graph(&self) -> Arc<CrateGraph>;
114} 114}
115 115
116fn parse_query(db: &impl SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> { 116fn parse_query(db: &dyn SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> {
117 let _p = profile("parse_query").detail(|| format!("{:?}", file_id)); 117 let _p = profile("parse_query").detail(|| format!("{:?}", file_id));
118 let text = db.file_text(file_id); 118 let text = db.file_text(file_id);
119 SourceFile::parse(&*text) 119 SourceFile::parse(&*text)
@@ -136,10 +136,7 @@ pub trait SourceDatabaseExt: SourceDatabase {
136 fn source_root_crates(&self, id: SourceRootId) -> Arc<FxHashSet<CrateId>>; 136 fn source_root_crates(&self, id: SourceRootId) -> Arc<FxHashSet<CrateId>>;
137} 137}
138 138
139fn source_root_crates( 139fn source_root_crates(db: &dyn SourceDatabaseExt, id: SourceRootId) -> Arc<FxHashSet<CrateId>> {
140 db: &(impl SourceDatabaseExt + SourceDatabase),
141 id: SourceRootId,
142) -> Arc<FxHashSet<CrateId>> {
143 let graph = db.crate_graph(); 140 let graph = db.crate_graph();
144 let res = graph 141 let res = graph
145 .iter() 142 .iter()