aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_db/src/lib.rs')
-rw-r--r--crates/ra_ide_db/src/lib.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ra_ide_db/src/lib.rs
index fc1b19def..4faeefa8d 100644
--- a/crates/ra_ide_db/src/lib.rs
+++ b/crates/ra_ide_db/src/lib.rs
@@ -14,10 +14,11 @@ mod wasm_shims;
14 14
15use std::sync::Arc; 15use std::sync::Arc;
16 16
17use hir::db::{AstDatabase, DefDatabase};
17use ra_db::{ 18use ra_db::{
18 salsa::{self, Database, Durability}, 19 salsa::{self, Database, Durability},
19 Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath, 20 Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath,
20 SourceDatabase, SourceRootId, 21 SourceDatabase, SourceRootId, Upcast,
21}; 22};
22use rustc_hash::FxHashMap; 23use rustc_hash::FxHashMap;
23 24
@@ -41,6 +42,18 @@ pub struct RootDatabase {
41 pub last_gc_check: crate::wasm_shims::Instant, 42 pub last_gc_check: crate::wasm_shims::Instant,
42} 43}
43 44
45impl Upcast<dyn AstDatabase> for RootDatabase {
46 fn upcast(&self) -> &(dyn AstDatabase + 'static) {
47 &*self
48 }
49}
50
51impl Upcast<dyn DefDatabase> for RootDatabase {
52 fn upcast(&self) -> &(dyn DefDatabase + 'static) {
53 &*self
54 }
55}
56
44impl FileLoader for RootDatabase { 57impl FileLoader for RootDatabase {
45 fn file_text(&self, file_id: FileId) -> Arc<String> { 58 fn file_text(&self, file_id: FileId) -> Arc<String> {
46 FileLoaderDelegate(self).file_text(file_id) 59 FileLoaderDelegate(self).file_text(file_id)