diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-15 13:35:12 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-15 13:35:12 +0100 |
commit | 9b024b685bf486c031cd72374c10955d6048ab63 (patch) | |
tree | a4a4761312b0ff12165e5b1a7155ccead4e09d71 /crates/ra_hir/src/db.rs | |
parent | 5ed6a13a2c81f24bd12cc74332f7e94301c73980 (diff) | |
parent | 1700541e0056691946f7274d7d2e7e6b50300313 (diff) |
Merge #1445
1445: Use the new "durability" infrastructure from salsa r=matklad a=matklad
Based on https://github.com/nikomatsakis/salsa/tree/durability
Durability allows us to skip *validation* work for sysroot and crates.io libraries, which massively speeds up some workloads
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r-- | crates/ra_hir/src/db.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 358365176..7b7974f5b 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use parking_lot::Mutex; | ||
4 | use ra_db::{salsa, SourceDatabase}; | 3 | use ra_db::{salsa, SourceDatabase}; |
5 | use ra_syntax::{ast, Parse, SmolStr, SyntaxNode}; | 4 | use ra_syntax::{ast, Parse, SmolStr, SyntaxNode}; |
6 | 5 | ||
@@ -147,6 +146,7 @@ pub trait DefDatabase: InternDatabase { | |||
147 | } | 146 | } |
148 | 147 | ||
149 | #[salsa::query_group(HirDatabaseStorage)] | 148 | #[salsa::query_group(HirDatabaseStorage)] |
149 | #[salsa::requires(salsa::Database)] | ||
150 | pub trait HirDatabase: DefDatabase + AstDatabase { | 150 | pub trait HirDatabase: DefDatabase + AstDatabase { |
151 | #[salsa::invoke(ExprScopes::expr_scopes_query)] | 151 | #[salsa::invoke(ExprScopes::expr_scopes_query)] |
152 | fn expr_scopes(&self, def: DefWithBody) -> Arc<ExprScopes>; | 152 | fn expr_scopes(&self, def: DefWithBody) -> Arc<ExprScopes>; |
@@ -187,11 +187,10 @@ pub trait HirDatabase: DefDatabase + AstDatabase { | |||
187 | /// This provides the Chalk trait solver instance. Because Chalk always | 187 | /// This provides the Chalk trait solver instance. Because Chalk always |
188 | /// works from a specific crate, this query is keyed on the crate; and | 188 | /// works from a specific crate, this query is keyed on the crate; and |
189 | /// because Chalk does its own internal caching, the solver is wrapped in a | 189 | /// because Chalk does its own internal caching, the solver is wrapped in a |
190 | /// Mutex and the query is marked volatile, to make sure the cached state is | 190 | /// Mutex and the query does an untracked read internally, to make sure the |
191 | /// thrown away when input facts change. | 191 | /// cached state is thrown away when input facts change. |
192 | #[salsa::invoke(crate::ty::traits::trait_solver_query)] | 192 | #[salsa::invoke(crate::ty::traits::trait_solver_query)] |
193 | #[salsa::volatile] | 193 | fn trait_solver(&self, krate: Crate) -> crate::ty::traits::TraitSolver; |
194 | fn trait_solver(&self, krate: Crate) -> Arc<Mutex<crate::ty::traits::Solver>>; | ||
195 | 194 | ||
196 | #[salsa::invoke(crate::ty::traits::chalk::associated_ty_data_query)] | 195 | #[salsa::invoke(crate::ty::traits::chalk::associated_ty_data_query)] |
197 | fn associated_ty_data(&self, id: chalk_ir::TypeId) -> Arc<chalk_rust_ir::AssociatedTyDatum>; | 196 | fn associated_ty_data(&self, id: chalk_ir::TypeId) -> Arc<chalk_rust_ir::AssociatedTyDatum>; |