diff options
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/lib.rs | 15 |
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 | ||
15 | use std::sync::Arc; | 15 | use std::sync::Arc; |
16 | 16 | ||
17 | use hir::db::{AstDatabase, DefDatabase}; | ||
17 | use ra_db::{ | 18 | use 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 | }; |
22 | use rustc_hash::FxHashMap; | 23 | use 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 | ||
45 | impl Upcast<dyn AstDatabase> for RootDatabase { | ||
46 | fn upcast(&self) -> &(dyn AstDatabase + 'static) { | ||
47 | &*self | ||
48 | } | ||
49 | } | ||
50 | |||
51 | impl Upcast<dyn DefDatabase> for RootDatabase { | ||
52 | fn upcast(&self) -> &(dyn DefDatabase + 'static) { | ||
53 | &*self | ||
54 | } | ||
55 | } | ||
56 | |||
44 | impl FileLoader for RootDatabase { | 57 | impl 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) |