aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/test_db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/test_db.rs')
-rw-r--r--crates/ra_hir_def/src/test_db.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs
index 0756916a8..eb83dee79 100644
--- a/crates/ra_hir_def/src/test_db.rs
+++ b/crates/ra_hir_def/src/test_db.rs
@@ -5,8 +5,12 @@ use std::{
5 sync::{Arc, Mutex}, 5 sync::{Arc, Mutex},
6}; 6};
7 7
8use hir_expand::db::AstDatabase;
9use ra_db::{
10 salsa, CrateId, ExternSourceId, FileId, FileLoader, FileLoaderDelegate, RelativePath, Upcast,
11};
12
8use crate::db::DefDatabase; 13use crate::db::DefDatabase;
9use ra_db::{salsa, CrateId, ExternSourceId, FileId, FileLoader, FileLoaderDelegate, RelativePath};
10 14
11#[salsa::database( 15#[salsa::database(
12 ra_db::SourceDatabaseExtStorage, 16 ra_db::SourceDatabaseExtStorage,
@@ -21,6 +25,18 @@ pub struct TestDB {
21 events: Mutex<Option<Vec<salsa::Event<TestDB>>>>, 25 events: Mutex<Option<Vec<salsa::Event<TestDB>>>>,
22} 26}
23 27
28impl Upcast<dyn AstDatabase> for TestDB {
29 fn upcast(&self) -> &(dyn AstDatabase + 'static) {
30 &*self
31 }
32}
33
34impl Upcast<dyn DefDatabase> for TestDB {
35 fn upcast(&self) -> &(dyn DefDatabase + 'static) {
36 &*self
37 }
38}
39
24impl salsa::Database for TestDB { 40impl salsa::Database for TestDB {
25 fn salsa_runtime(&self) -> &salsa::Runtime<Self> { 41 fn salsa_runtime(&self) -> &salsa::Runtime<Self> {
26 &self.runtime 42 &self.runtime