From 958862093e83083b188427246323047a2c9e7bab Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 23 Nov 2019 14:43:38 +0300 Subject: Move docs to hir_def --- crates/ra_hir_def/src/db.rs | 6 ++++ crates/ra_hir_def/src/docs.rs | 68 +++++++++++++++++++++++++++++++++++++++++++ crates/ra_hir_def/src/lib.rs | 1 + 3 files changed, 75 insertions(+) create mode 100644 crates/ra_hir_def/src/docs.rs (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs index e87bd525a..1481868d0 100644 --- a/crates/ra_hir_def/src/db.rs +++ b/crates/ra_hir_def/src/db.rs @@ -10,6 +10,7 @@ use crate::{ attr::Attrs, body::{scope::ExprScopes, Body, BodySourceMap}, data::{ConstData, FunctionData, ImplData, TraitData, TypeAliasData}, + docs::Documentation, generics::GenericParams, lang_item::{LangItemTarget, LangItems}, nameres::{ @@ -101,4 +102,9 @@ pub trait DefDatabase2: InternDatabase + AstDatabase { #[salsa::invoke(LangItems::lang_item_query)] fn lang_item(&self, start_crate: CrateId, item: SmolStr) -> Option; + + // FIXME(https://github.com/rust-analyzer/rust-analyzer/issues/2148#issuecomment-550519102) + // Remove this query completely, in favor of `Attrs::docs` method + #[salsa::invoke(Documentation::documentation_query)] + fn documentation(&self, def: AttrDefId) -> Option; } diff --git a/crates/ra_hir_def/src/docs.rs b/crates/ra_hir_def/src/docs.rs new file mode 100644 index 000000000..1b5c85437 --- /dev/null +++ b/crates/ra_hir_def/src/docs.rs @@ -0,0 +1,68 @@ +//! FIXME: write short doc here + +use std::sync::Arc; + +use hir_expand::either::Either; +use ra_syntax::ast; + +use crate::{db::DefDatabase2, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup}; + +/// Holds documentation +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Documentation(Arc); + +impl Into for Documentation { + fn into(self) -> String { + self.as_str().to_owned() + } +} + +impl Documentation { + fn new(s: &str) -> Documentation { + Documentation(s.into()) + } + + pub fn as_str(&self) -> &str { + &*self.0 + } + + pub(crate) fn documentation_query( + db: &impl DefDatabase2, + def: AttrDefId, + ) -> Option { + match def { + AttrDefId::ModuleId(module) => { + let def_map = db.crate_def_map(module.krate); + let src = def_map[module.module_id].declaration_source(db)?; + docs_from_ast(&src.value) + } + AttrDefId::StructFieldId(it) => { + let src = it.parent.child_source(db); + match &src.value[it.local_id] { + Either::A(_tuple) => None, + Either::B(record) => docs_from_ast(record), + } + } + AttrDefId::AdtId(it) => match it { + AdtId::StructId(it) => docs_from_ast(&it.0.source(db).value), + AdtId::EnumId(it) => docs_from_ast(&it.source(db).value), + AdtId::UnionId(it) => docs_from_ast(&it.0.source(db).value), + }, + AttrDefId::EnumVariantId(it) => { + let src = it.parent.child_source(db); + docs_from_ast(&src.value[it.local_id]) + } + AttrDefId::StaticId(it) => docs_from_ast(&it.source(db).value), + AttrDefId::TraitId(it) => docs_from_ast(&it.source(db).value), + AttrDefId::MacroDefId(it) => docs_from_ast(&it.ast_id.to_node(db)), + AttrDefId::ConstId(it) => docs_from_ast(&it.lookup(db).source(db).value), + AttrDefId::FunctionId(it) => docs_from_ast(&it.lookup(db).source(db).value), + AttrDefId::TypeAliasId(it) => docs_from_ast(&it.lookup(db).source(db).value), + AttrDefId::ImplId(_) => None, + } + } +} + +pub(crate) fn docs_from_ast(node: &impl ast::DocCommentsOwner) -> Option { + node.doc_comment_text().map(|it| Documentation::new(&it)) +} diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 899510be4..1ba7c7ee3 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -20,6 +20,7 @@ pub mod generics; pub mod resolver; pub mod data; pub mod lang_item; +pub mod docs; mod trace; -- cgit v1.2.3 From fc1e543f7abb69b8cab308410fa0a127950ee1c5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 23 Nov 2019 14:44:43 +0300 Subject: Get rid of DefDatabase2 --- crates/ra_hir_def/src/adt.rs | 13 ++--- crates/ra_hir_def/src/attr.rs | 8 ++-- crates/ra_hir_def/src/body.rs | 16 +++---- crates/ra_hir_def/src/body/lower.rs | 6 +-- crates/ra_hir_def/src/body/scope.rs | 6 +-- crates/ra_hir_def/src/data.rs | 14 +++--- crates/ra_hir_def/src/db.rs | 4 +- crates/ra_hir_def/src/docs.rs | 4 +- crates/ra_hir_def/src/generics.rs | 8 ++-- crates/ra_hir_def/src/lang_item.rs | 12 ++--- crates/ra_hir_def/src/lib.rs | 45 +++++++++--------- crates/ra_hir_def/src/nameres.rs | 16 +++---- crates/ra_hir_def/src/nameres/collector.rs | 12 ++--- crates/ra_hir_def/src/nameres/mod_resolution.rs | 4 +- crates/ra_hir_def/src/nameres/path_resolution.rs | 8 ++-- crates/ra_hir_def/src/nameres/raw.rs | 6 +-- crates/ra_hir_def/src/nameres/tests.rs | 2 +- crates/ra_hir_def/src/resolver.rs | 60 +++++++++++------------- crates/ra_hir_def/src/test_db.rs | 2 +- 19 files changed, 118 insertions(+), 128 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index ae99afe39..20e9a1eb5 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs @@ -11,7 +11,7 @@ use ra_arena::{map::ArenaMap, Arena}; use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; use crate::{ - db::DefDatabase2, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId, HasChildSource, + db::DefDatabase, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId, HasChildSource, LocalEnumVariantId, LocalStructFieldId, StructOrUnionId, VariantId, }; @@ -49,10 +49,7 @@ pub struct StructFieldData { } impl StructData { - pub(crate) fn struct_data_query( - db: &impl DefDatabase2, - id: StructOrUnionId, - ) -> Arc { + pub(crate) fn struct_data_query(db: &impl DefDatabase, id: StructOrUnionId) -> Arc { let src = id.source(db); let name = src.value.name().map(|n| n.as_name()); let variant_data = VariantData::new(src.value.kind()); @@ -62,7 +59,7 @@ impl StructData { } impl EnumData { - pub(crate) fn enum_data_query(db: &impl DefDatabase2, e: EnumId) -> Arc { + pub(crate) fn enum_data_query(db: &impl DefDatabase, e: EnumId) -> Arc { let src = e.source(db); let name = src.value.name().map(|n| n.as_name()); let mut trace = Trace::new_for_arena(); @@ -79,7 +76,7 @@ impl EnumData { impl HasChildSource for EnumId { type ChildId = LocalEnumVariantId; type Value = ast::EnumVariant; - fn child_source(&self, db: &impl DefDatabase2) -> Source> { + fn child_source(&self, db: &impl DefDatabase) -> Source> { let src = self.source(db); let mut trace = Trace::new_for_map(); lower_enum(&mut trace, &src.value); @@ -124,7 +121,7 @@ impl HasChildSource for VariantId { type ChildId = LocalStructFieldId; type Value = Either; - fn child_source(&self, db: &impl DefDatabase2) -> Source> { + fn child_source(&self, db: &impl DefDatabase) -> Source> { let src = match self { VariantId::EnumVariantId(it) => { // I don't really like the fact that we call into parent source diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index eee5e44bf..48ce8cd93 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs @@ -12,7 +12,7 @@ use ra_syntax::{ use tt::Subtree; use crate::{ - db::DefDatabase2, path::Path, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup, + db::DefDatabase, path::Path, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup, }; #[derive(Default, Debug, Clone, PartialEq, Eq)] @@ -32,7 +32,7 @@ impl ops::Deref for Attrs { } impl Attrs { - pub(crate) fn attrs_query(db: &impl DefDatabase2, def: AttrDefId) -> Attrs { + pub(crate) fn attrs_query(db: &impl DefDatabase, def: AttrDefId) -> Attrs { match def { AttrDefId::ModuleId(module) => { let def_map = db.crate_def_map(module.krate); @@ -162,7 +162,7 @@ impl Attr { fn attrs_from_ast(src: AstId, db: &D) -> Attrs where N: ast::AttrsOwner, - D: DefDatabase2, + D: DefDatabase, { let hygiene = Hygiene::new(db, src.file_id()); Attr::from_attrs_owner(&src.to_node(db), &hygiene) @@ -172,7 +172,7 @@ fn attrs_from_loc(node: T, db: &D) -> Attrs where T: HasSource, T::Value: ast::AttrsOwner, - D: DefDatabase2, + D: DefDatabase, { let src = node.source(db); let hygiene = Hygiene::new(db, src.file_id); diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index dfb79a30a..225638b42 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs @@ -13,7 +13,7 @@ use ra_syntax::{ast, AstNode, AstPtr}; use rustc_hash::FxHashMap; use crate::{ - db::DefDatabase2, + db::DefDatabase, expr::{Expr, ExprId, Pat, PatId}, nameres::CrateDefMap, path::Path, @@ -28,7 +28,7 @@ pub struct Expander { } impl Expander { - pub fn new(db: &impl DefDatabase2, current_file_id: HirFileId, module: ModuleId) -> Expander { + pub fn new(db: &impl DefDatabase, current_file_id: HirFileId, module: ModuleId) -> Expander { let crate_def_map = db.crate_def_map(module.krate); let hygiene = Hygiene::new(db, current_file_id); Expander { crate_def_map, current_file_id, hygiene, module } @@ -36,7 +36,7 @@ impl Expander { fn enter_expand( &mut self, - db: &impl DefDatabase2, + db: &impl DefDatabase, macro_call: ast::MacroCall, ) -> Option<(Mark, ast::Expr)> { let ast_id = AstId::new( @@ -67,7 +67,7 @@ impl Expander { None } - fn exit(&mut self, db: &impl DefDatabase2, mark: Mark) { + fn exit(&mut self, db: &impl DefDatabase, mark: Mark) { self.hygiene = Hygiene::new(db, mark.file_id); self.current_file_id = mark.file_id; std::mem::forget(mark); @@ -81,7 +81,7 @@ impl Expander { Path::from_src(path, &self.hygiene) } - fn resolve_path_as_macro(&self, db: &impl DefDatabase2, path: &Path) -> Option { + fn resolve_path_as_macro(&self, db: &impl DefDatabase, path: &Path) -> Option { self.crate_def_map.resolve_path(db, self.module.module_id, path).0.get_macros() } } @@ -142,7 +142,7 @@ pub struct BodySourceMap { impl Body { pub(crate) fn body_with_source_map_query( - db: &impl DefDatabase2, + db: &impl DefDatabase, def: DefWithBodyId, ) -> (Arc, Arc) { let mut params = None; @@ -169,12 +169,12 @@ impl Body { (Arc::new(body), Arc::new(source_map)) } - pub(crate) fn body_query(db: &impl DefDatabase2, def: DefWithBodyId) -> Arc { + pub(crate) fn body_query(db: &impl DefDatabase, def: DefWithBodyId) -> Arc { db.body_with_source_map(def).0 } fn new( - db: &impl DefDatabase2, + db: &impl DefDatabase, expander: Expander, params: Option, body: Option, diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index d8e911aa5..f4640dfa4 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -17,7 +17,7 @@ use test_utils::tested_by; use crate::{ body::{Body, BodySourceMap, Expander, PatPtr}, builtin_type::{BuiltinFloat, BuiltinInt}, - db::DefDatabase2, + db::DefDatabase, expr::{ ArithOp, Array, BinaryOp, BindingAnnotation, CmpOp, Expr, ExprId, Literal, LogicOp, MatchArm, Ordering, Pat, PatId, RecordFieldPat, RecordLitField, Statement, @@ -28,7 +28,7 @@ use crate::{ }; pub(super) fn lower( - db: &impl DefDatabase2, + db: &impl DefDatabase, expander: Expander, params: Option, body: Option, @@ -57,7 +57,7 @@ struct ExprCollector { impl<'a, DB> ExprCollector<&'a DB> where - DB: DefDatabase2, + DB: DefDatabase, { fn collect( mut self, diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 58740b679..20d707bc4 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs @@ -7,7 +7,7 @@ use rustc_hash::FxHashMap; use crate::{ body::Body, - db::DefDatabase2, + db::DefDatabase, expr::{Expr, ExprId, Pat, PatId, Statement}, DefWithBodyId, }; @@ -45,7 +45,7 @@ pub struct ScopeData { } impl ExprScopes { - pub(crate) fn expr_scopes_query(db: &impl DefDatabase2, def: DefWithBodyId) -> Arc { + pub(crate) fn expr_scopes_query(db: &impl DefDatabase, def: DefWithBodyId) -> Arc { let body = db.body(def); Arc::new(ExprScopes::new(&*body)) } @@ -176,7 +176,7 @@ mod tests { use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; use test_utils::{assert_eq_text, covers, extract_offset}; - use crate::{db::DefDatabase2, test_db::TestDB, FunctionId, ModuleDefId}; + use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId}; fn find_function(db: &TestDB, file_id: FileId) -> FunctionId { let krate = db.test_crate(); diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index 91bac7415..f0b3e198a 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs @@ -9,7 +9,7 @@ use hir_expand::{ use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; use crate::{ - db::DefDatabase2, + db::DefDatabase, type_ref::{Mutability, TypeRef}, AssocItemId, AstItemDef, ConstId, ConstLoc, ContainerId, FunctionId, FunctionLoc, HasSource, ImplId, Intern, Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc, @@ -26,7 +26,7 @@ pub struct FunctionData { } impl FunctionData { - pub(crate) fn fn_data_query(db: &impl DefDatabase2, func: FunctionId) -> Arc { + pub(crate) fn fn_data_query(db: &impl DefDatabase, func: FunctionId) -> Arc { let src = func.lookup(db).source(db); let name = src.value.name().map(|n| n.as_name()).unwrap_or_else(Name::missing); let mut params = Vec::new(); @@ -74,7 +74,7 @@ pub struct TypeAliasData { impl TypeAliasData { pub(crate) fn type_alias_data_query( - db: &impl DefDatabase2, + db: &impl DefDatabase, typ: TypeAliasId, ) -> Arc { let node = typ.lookup(db).source(db).value; @@ -92,7 +92,7 @@ pub struct TraitData { } impl TraitData { - pub(crate) fn trait_data_query(db: &impl DefDatabase2, tr: TraitId) -> Arc { + pub(crate) fn trait_data_query(db: &impl DefDatabase, tr: TraitId) -> Arc { let src = tr.source(db); let name = src.value.name().map(|n| n.as_name()); let auto = src.value.is_auto(); @@ -144,7 +144,7 @@ pub struct ImplData { } impl ImplData { - pub(crate) fn impl_data_query(db: &impl DefDatabase2, id: ImplId) -> Arc { + pub(crate) fn impl_data_query(db: &impl DefDatabase, id: ImplId) -> Arc { let src = id.source(db); let items = db.ast_id_map(src.file_id); @@ -198,12 +198,12 @@ pub struct ConstData { } impl ConstData { - pub(crate) fn const_data_query(db: &impl DefDatabase2, konst: ConstId) -> Arc { + pub(crate) fn const_data_query(db: &impl DefDatabase, konst: ConstId) -> Arc { let node = konst.lookup(db).source(db).value; const_data_for(&node) } - pub(crate) fn static_data_query(db: &impl DefDatabase2, konst: StaticId) -> Arc { + pub(crate) fn static_data_query(db: &impl DefDatabase, konst: StaticId) -> Arc { let node = konst.source(db).value; const_data_for(&node) } diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs index 1481868d0..cf3a6ccd8 100644 --- a/crates/ra_hir_def/src/db.rs +++ b/crates/ra_hir_def/src/db.rs @@ -41,8 +41,8 @@ pub trait InternDatabase: SourceDatabase { fn intern_impl(&self, loc: ItemLoc) -> crate::ImplId; } -#[salsa::query_group(DefDatabase2Storage)] -pub trait DefDatabase2: InternDatabase + AstDatabase { +#[salsa::query_group(DefDatabaseStorage)] +pub trait DefDatabase: InternDatabase + AstDatabase { #[salsa::invoke(RawItems::raw_items_with_source_map_query)] fn raw_items_with_source_map( &self, diff --git a/crates/ra_hir_def/src/docs.rs b/crates/ra_hir_def/src/docs.rs index 1b5c85437..69846fd1b 100644 --- a/crates/ra_hir_def/src/docs.rs +++ b/crates/ra_hir_def/src/docs.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use hir_expand::either::Either; use ra_syntax::ast; -use crate::{db::DefDatabase2, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup}; +use crate::{db::DefDatabase, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup}; /// Holds documentation #[derive(Debug, Clone, PartialEq, Eq)] @@ -27,7 +27,7 @@ impl Documentation { } pub(crate) fn documentation_query( - db: &impl DefDatabase2, + db: &impl DefDatabase, def: AttrDefId, ) -> Option { match def { diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs index 9e2e4c3cc..015fe772e 100644 --- a/crates/ra_hir_def/src/generics.rs +++ b/crates/ra_hir_def/src/generics.rs @@ -8,7 +8,7 @@ use hir_expand::name::{self, AsName, Name}; use ra_syntax::ast::{self, NameOwner, TypeBoundsOwner, TypeParamsOwner}; use crate::{ - db::DefDatabase2, + db::DefDatabase, type_ref::{TypeBound, TypeRef}, AdtId, AstItemDef, ContainerId, GenericDefId, HasSource, Lookup, }; @@ -42,7 +42,7 @@ pub struct WherePredicate { impl GenericParams { pub(crate) fn generic_params_query( - db: &impl DefDatabase2, + db: &impl DefDatabase, def: GenericDefId, ) -> Arc { let parent_generics = parent_generic_def(db, def).map(|it| db.generic_params(it)); @@ -50,7 +50,7 @@ impl GenericParams { } fn new( - db: &impl DefDatabase2, + db: &impl DefDatabase, def: GenericDefId, parent_params: Option>, ) -> GenericParams { @@ -168,7 +168,7 @@ impl GenericParams { } } -fn parent_generic_def(db: &impl DefDatabase2, def: GenericDefId) -> Option { +fn parent_generic_def(db: &impl DefDatabase, def: GenericDefId) -> Option { let container = match def { GenericDefId::FunctionId(it) => it.lookup(db).container, GenericDefId::TypeAliasId(it) => it.lookup(db).container, diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs index 4c1a764ea..df951c533 100644 --- a/crates/ra_hir_def/src/lang_item.rs +++ b/crates/ra_hir_def/src/lang_item.rs @@ -8,7 +8,7 @@ use ra_syntax::SmolStr; use rustc_hash::FxHashMap; use crate::{ - db::DefDatabase2, AdtId, AttrDefId, CrateId, EnumId, FunctionId, ImplId, ModuleDefId, ModuleId, + db::DefDatabase, AdtId, AttrDefId, CrateId, EnumId, FunctionId, ImplId, ModuleDefId, ModuleId, StaticId, StructId, TraitId, }; @@ -33,7 +33,7 @@ impl LangItems { } /// Salsa query. This will look for lang items in a specific crate. - pub(crate) fn crate_lang_items_query(db: &impl DefDatabase2, krate: CrateId) -> Arc { + pub(crate) fn crate_lang_items_query(db: &impl DefDatabase, krate: CrateId) -> Arc { let mut lang_items = LangItems::default(); let crate_def_map = db.crate_def_map(krate); @@ -47,7 +47,7 @@ impl LangItems { } pub(crate) fn module_lang_items_query( - db: &impl DefDatabase2, + db: &impl DefDatabase, module: ModuleId, ) -> Option> { let mut lang_items = LangItems::default(); @@ -62,7 +62,7 @@ impl LangItems { /// Salsa query. Look for a lang item, starting from the specified crate and recursively /// traversing its dependencies. pub(crate) fn lang_item_query( - db: &impl DefDatabase2, + db: &impl DefDatabase, start_crate: CrateId, item: SmolStr, ) -> Option { @@ -76,7 +76,7 @@ impl LangItems { .find_map(|dep| db.lang_item(dep.crate_id, item.clone())) } - fn collect_lang_items(&mut self, db: &impl DefDatabase2, module: ModuleId) { + fn collect_lang_items(&mut self, db: &impl DefDatabase, module: ModuleId) { // Look for impl targets let def_map = db.crate_def_map(module.krate); let module_data = &def_map[module.module_id]; @@ -106,7 +106,7 @@ impl LangItems { fn collect_lang_item( &mut self, - db: &impl DefDatabase2, + db: &impl DefDatabase, item: T, constructor: fn(T) -> LangItemTarget, ) where diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 1ba7c7ee3..1b2bc6f45 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -48,7 +48,7 @@ pub enum ModuleSource { impl ModuleSource { pub fn new( - db: &impl db::DefDatabase2, + db: &impl db::DefDatabase, file_id: Option, decl_id: Option>, ) -> ModuleSource { @@ -67,10 +67,7 @@ impl ModuleSource { } // FIXME: this methods do not belong here - pub fn from_position( - db: &impl db::DefDatabase2, - position: ra_db::FilePosition, - ) -> ModuleSource { + pub fn from_position(db: &impl db::DefDatabase, position: ra_db::FilePosition) -> ModuleSource { let parse = db.parse(position.file_id); match &ra_syntax::algo::find_node_at_offset::( parse.tree().syntax(), @@ -84,7 +81,7 @@ impl ModuleSource { } } - pub fn from_child_node(db: &impl db::DefDatabase2, child: Source<&SyntaxNode>) -> ModuleSource { + pub fn from_child_node(db: &impl db::DefDatabase, child: Source<&SyntaxNode>) -> ModuleSource { if let Some(m) = child.value.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) { @@ -96,7 +93,7 @@ impl ModuleSource { } } - pub fn from_file_id(db: &impl db::DefDatabase2, file_id: FileId) -> ModuleSource { + pub fn from_file_id(db: &impl db::DefDatabase, file_id: FileId) -> ModuleSource { let source_file = db.parse(file_id).tree(); ModuleSource::SourceFile(source_file) } @@ -211,14 +208,14 @@ pub struct FunctionLoc { impl Intern for FunctionLoc { type ID = FunctionId; - fn intern(self, db: &impl db::DefDatabase2) -> FunctionId { + fn intern(self, db: &impl db::DefDatabase) -> FunctionId { db.intern_function(self) } } impl Lookup for FunctionId { type Data = FunctionLoc; - fn lookup(&self, db: &impl db::DefDatabase2) -> FunctionLoc { + fn lookup(&self, db: &impl db::DefDatabase) -> FunctionLoc { db.lookup_intern_function(*self) } } @@ -301,14 +298,14 @@ pub struct ConstLoc { impl Intern for ConstLoc { type ID = ConstId; - fn intern(self, db: &impl db::DefDatabase2) -> ConstId { + fn intern(self, db: &impl db::DefDatabase) -> ConstId { db.intern_const(self) } } impl Lookup for ConstId { type Data = ConstLoc; - fn lookup(&self, db: &impl db::DefDatabase2) -> ConstLoc { + fn lookup(&self, db: &impl db::DefDatabase) -> ConstLoc { db.lookup_intern_const(*self) } } @@ -349,14 +346,14 @@ pub struct TypeAliasLoc { impl Intern for TypeAliasLoc { type ID = TypeAliasId; - fn intern(self, db: &impl db::DefDatabase2) -> TypeAliasId { + fn intern(self, db: &impl db::DefDatabase) -> TypeAliasId { db.intern_type_alias(self) } } impl Lookup for TypeAliasId { type Data = TypeAliasLoc; - fn lookup(&self, db: &impl db::DefDatabase2) -> TypeAliasLoc { + fn lookup(&self, db: &impl db::DefDatabase) -> TypeAliasLoc { db.lookup_intern_type_alias(*self) } } @@ -510,20 +507,20 @@ impl_froms!( trait Intern { type ID; - fn intern(self, db: &impl db::DefDatabase2) -> Self::ID; + fn intern(self, db: &impl db::DefDatabase) -> Self::ID; } pub trait Lookup { type Data; - fn lookup(&self, db: &impl db::DefDatabase2) -> Self::Data; + fn lookup(&self, db: &impl db::DefDatabase) -> Self::Data; } pub trait HasModule { - fn module(&self, db: &impl db::DefDatabase2) -> ModuleId; + fn module(&self, db: &impl db::DefDatabase) -> ModuleId; } impl HasModule for FunctionLoc { - fn module(&self, db: &impl db::DefDatabase2) -> ModuleId { + fn module(&self, db: &impl db::DefDatabase) -> ModuleId { match self.container { ContainerId::ModuleId(it) => it, ContainerId::ImplId(it) => it.module(db), @@ -533,7 +530,7 @@ impl HasModule for FunctionLoc { } impl HasModule for TypeAliasLoc { - fn module(&self, db: &impl db::DefDatabase2) -> ModuleId { + fn module(&self, db: &impl db::DefDatabase) -> ModuleId { match self.container { ContainerId::ModuleId(it) => it, ContainerId::ImplId(it) => it.module(db), @@ -543,7 +540,7 @@ impl HasModule for TypeAliasLoc { } impl HasModule for ConstLoc { - fn module(&self, db: &impl db::DefDatabase2) -> ModuleId { + fn module(&self, db: &impl db::DefDatabase) -> ModuleId { match self.container { ContainerId::ModuleId(it) => it, ContainerId::ImplId(it) => it.module(db), @@ -554,13 +551,13 @@ impl HasModule for ConstLoc { pub trait HasSource { type Value; - fn source(&self, db: &impl db::DefDatabase2) -> Source; + fn source(&self, db: &impl db::DefDatabase) -> Source; } impl HasSource for FunctionLoc { type Value = ast::FnDef; - fn source(&self, db: &impl db::DefDatabase2) -> Source { + fn source(&self, db: &impl db::DefDatabase) -> Source { let node = self.ast_id.to_node(db); Source::new(self.ast_id.file_id(), node) } @@ -569,7 +566,7 @@ impl HasSource for FunctionLoc { impl HasSource for TypeAliasLoc { type Value = ast::TypeAliasDef; - fn source(&self, db: &impl db::DefDatabase2) -> Source { + fn source(&self, db: &impl db::DefDatabase) -> Source { let node = self.ast_id.to_node(db); Source::new(self.ast_id.file_id(), node) } @@ -578,7 +575,7 @@ impl HasSource for TypeAliasLoc { impl HasSource for ConstLoc { type Value = ast::ConstDef; - fn source(&self, db: &impl db::DefDatabase2) -> Source { + fn source(&self, db: &impl db::DefDatabase) -> Source { let node = self.ast_id.to_node(db); Source::new(self.ast_id.file_id(), node) } @@ -589,6 +586,6 @@ pub trait HasChildSource { type Value; fn child_source( &self, - db: &impl db::DefDatabase2, + db: &impl db::DefDatabase, ) -> Source>; } diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 6723465a5..101203b7b 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs @@ -71,7 +71,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; use crate::{ builtin_type::BuiltinType, - db::DefDatabase2, + db::DefDatabase, nameres::{ diagnostics::DefDiagnostic, path_resolution::ResolveMode, per_ns::PerNs, raw::ImportId, }, @@ -220,7 +220,7 @@ impl CrateDefMap { pub(crate) fn crate_def_map_query( // Note that this doesn't have `+ AstDatabase`! // This gurantess that `CrateDefMap` is stable across reparses. - db: &impl DefDatabase2, + db: &impl DefDatabase, krate: CrateId, ) -> Arc { let _p = profile("crate_def_map_query"); @@ -262,7 +262,7 @@ impl CrateDefMap { pub fn add_diagnostics( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, module: CrateModuleId, sink: &mut DiagnosticSink, ) { @@ -271,7 +271,7 @@ impl CrateDefMap { pub fn resolve_path( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, original_module: CrateModuleId, path: &Path, ) -> (PerNs, Option) { @@ -295,7 +295,7 @@ impl ModuleData { /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. pub fn definition_source( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, ) -> Source> { if let Some(file_id) = self.definition { let sf = db.parse(file_id).tree(); @@ -307,7 +307,7 @@ impl ModuleData { /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. /// `None` for the crate root. - pub fn declaration_source(&self, db: &impl DefDatabase2) -> Option> { + pub fn declaration_source(&self, db: &impl DefDatabase) -> Option> { let decl = self.declaration?; let value = decl.to_node(db); Some(Source { file_id: decl.file_id(), value }) @@ -319,7 +319,7 @@ mod diagnostics { use ra_db::RelativePathBuf; use ra_syntax::{ast, AstPtr}; - use crate::{db::DefDatabase2, diagnostics::UnresolvedModule, nameres::CrateModuleId, AstId}; + use crate::{db::DefDatabase, diagnostics::UnresolvedModule, nameres::CrateModuleId, AstId}; #[derive(Debug, PartialEq, Eq)] pub(super) enum DefDiagnostic { @@ -333,7 +333,7 @@ mod diagnostics { impl DefDiagnostic { pub(super) fn add_to( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, target_module: CrateModuleId, sink: &mut DiagnosticSink, ) { diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 7902293e8..1894b072a 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -13,7 +13,7 @@ use test_utils::tested_by; use crate::{ attr::Attrs, - db::DefDatabase2, + db::DefDatabase, nameres::{ diagnostics::DefDiagnostic, mod_resolution::ModDir, path_resolution::ReachedFixedPoint, per_ns::PerNs, raw, CrateDefMap, ModuleData, Resolution, ResolveMode, @@ -24,7 +24,7 @@ use crate::{ StructOrUnionId, TraitId, TypeAliasLoc, UnionId, }; -pub(super) fn collect_defs(db: &impl DefDatabase2, mut def_map: CrateDefMap) -> CrateDefMap { +pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { let crate_graph = db.crate_graph(); // populate external prelude @@ -108,7 +108,7 @@ struct DefCollector<'a, DB> { impl DefCollector<'_, DB> where - DB: DefDatabase2, + DB: DefDatabase, { fn collect(&mut self) { let crate_graph = self.db.crate_graph(); @@ -530,7 +530,7 @@ struct ModCollector<'a, D> { impl ModCollector<'_, &'_ mut DefCollector<'_, DB>> where - DB: DefDatabase2, + DB: DefDatabase, { fn collect(&mut self, items: &[raw::RawItem]) { // Note: don't assert that inserted value is fresh: it's simply not true @@ -798,12 +798,12 @@ mod tests { use ra_db::{fixture::WithFixture, SourceDatabase}; use rustc_hash::FxHashSet; - use crate::{db::DefDatabase2, test_db::TestDB}; + use crate::{db::DefDatabase, test_db::TestDB}; use super::*; fn do_collect_defs( - db: &impl DefDatabase2, + db: &impl DefDatabase, def_map: CrateDefMap, monitor: MacroStackMonitor, ) -> CrateDefMap { diff --git a/crates/ra_hir_def/src/nameres/mod_resolution.rs b/crates/ra_hir_def/src/nameres/mod_resolution.rs index b3b1379d0..14fb8ba3a 100644 --- a/crates/ra_hir_def/src/nameres/mod_resolution.rs +++ b/crates/ra_hir_def/src/nameres/mod_resolution.rs @@ -3,7 +3,7 @@ use hir_expand::name::Name; use ra_db::{FileId, RelativePathBuf}; use ra_syntax::SmolStr; -use crate::{db::DefDatabase2, HirFileId}; +use crate::{db::DefDatabase, HirFileId}; #[derive(Clone, Debug)] pub(super) struct ModDir { @@ -40,7 +40,7 @@ impl ModDir { pub(super) fn resolve_declaration( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, file_id: HirFileId, name: &Name, attr_path: Option<&SmolStr>, diff --git a/crates/ra_hir_def/src/nameres/path_resolution.rs b/crates/ra_hir_def/src/nameres/path_resolution.rs index 95692f826..102009ac7 100644 --- a/crates/ra_hir_def/src/nameres/path_resolution.rs +++ b/crates/ra_hir_def/src/nameres/path_resolution.rs @@ -15,7 +15,7 @@ use ra_db::Edition; use test_utils::tested_by; use crate::{ - db::DefDatabase2, + db::DefDatabase, nameres::{per_ns::PerNs, CrateDefMap}, path::{Path, PathKind}, AdtId, CrateModuleId, EnumVariantId, ModuleDefId, ModuleId, @@ -63,7 +63,7 @@ impl CrateDefMap { // the result. pub(super) fn resolve_path_fp_with_macro( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, mode: ResolveMode, original_module: CrateModuleId, path: &Path, @@ -216,7 +216,7 @@ impl CrateDefMap { fn resolve_name_in_module( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, module: CrateModuleId, name: &Name, ) -> PerNs { @@ -243,7 +243,7 @@ impl CrateDefMap { from_crate_root.or(from_extern_prelude) } - fn resolve_in_prelude(&self, db: &impl DefDatabase2, name: &Name) -> PerNs { + fn resolve_in_prelude(&self, db: &impl DefDatabase, name: &Name) -> PerNs { if let Some(prelude) = self.prelude { let keep; let def_map = if prelude.krate == self.krate { diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 55a9634f8..7618cb059 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs @@ -18,7 +18,7 @@ use test_utils::tested_by; use crate::{ attr::{Attr, Attrs}, - db::DefDatabase2, + db::DefDatabase, path::Path, FileAstId, HirFileId, ModuleSource, Source, }; @@ -67,14 +67,14 @@ impl ImportSourceMap { impl RawItems { pub(crate) fn raw_items_query( - db: &(impl DefDatabase2 + AstDatabase), + db: &(impl DefDatabase + AstDatabase), file_id: HirFileId, ) -> Arc { db.raw_items_with_source_map(file_id).0 } pub(crate) fn raw_items_with_source_map_query( - db: &(impl DefDatabase2 + AstDatabase), + db: &(impl DefDatabase + AstDatabase), file_id: HirFileId, ) -> (Arc, Arc) { let mut collector = RawItemsCollector { diff --git a/crates/ra_hir_def/src/nameres/tests.rs b/crates/ra_hir_def/src/nameres/tests.rs index 256f7d4be..b5053ba20 100644 --- a/crates/ra_hir_def/src/nameres/tests.rs +++ b/crates/ra_hir_def/src/nameres/tests.rs @@ -10,7 +10,7 @@ use insta::assert_snapshot; use ra_db::{fixture::WithFixture, SourceDatabase}; use test_utils::covers; -use crate::{db::DefDatabase2, nameres::*, test_db::TestDB, CrateModuleId}; +use crate::{db::DefDatabase, nameres::*, test_db::TestDB, CrateModuleId}; fn def_map(fixtute: &str) -> String { let dm = compute_crate_def_map(fixtute); diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs index 7b5c3ec06..48a836a20 100644 --- a/crates/ra_hir_def/src/resolver.rs +++ b/crates/ra_hir_def/src/resolver.rs @@ -11,7 +11,7 @@ use rustc_hash::FxHashSet; use crate::{ body::scope::{ExprScopes, ScopeId}, builtin_type::BuiltinType, - db::DefDatabase2, + db::DefDatabase, expr::{ExprId, PatId}, generics::GenericParams, nameres::{per_ns::PerNs, CrateDefMap}, @@ -87,7 +87,7 @@ pub enum ValueNs { impl Resolver { /// Resolve known trait from std, like `std::futures::Future` - pub fn resolve_known_trait(&self, db: &impl DefDatabase2, path: &Path) -> Option { + pub fn resolve_known_trait(&self, db: &impl DefDatabase, path: &Path) -> Option { let res = self.resolve_module_path(db, path).take_types()?; match res { ModuleDefId::TraitId(it) => Some(it), @@ -96,7 +96,7 @@ impl Resolver { } /// Resolve known struct from std, like `std::boxed::Box` - pub fn resolve_known_struct(&self, db: &impl DefDatabase2, path: &Path) -> Option { + pub fn resolve_known_struct(&self, db: &impl DefDatabase, path: &Path) -> Option { let res = self.resolve_module_path(db, path).take_types()?; match res { ModuleDefId::AdtId(AdtId::StructId(it)) => Some(it), @@ -105,7 +105,7 @@ impl Resolver { } /// Resolve known enum from std, like `std::result::Result` - pub fn resolve_known_enum(&self, db: &impl DefDatabase2, path: &Path) -> Option { + pub fn resolve_known_enum(&self, db: &impl DefDatabase, path: &Path) -> Option { let res = self.resolve_module_path(db, path).take_types()?; match res { ModuleDefId::AdtId(AdtId::EnumId(it)) => Some(it), @@ -114,7 +114,7 @@ impl Resolver { } /// pub only for source-binder - pub fn resolve_module_path(&self, db: &impl DefDatabase2, path: &Path) -> PerNs { + pub fn resolve_module_path(&self, db: &impl DefDatabase, path: &Path) -> PerNs { let (item_map, module) = match self.module() { Some(it) => it, None => return PerNs::none(), @@ -128,7 +128,7 @@ impl Resolver { pub fn resolve_path_in_type_ns( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, path: &Path, ) -> Option<(TypeNs, Option)> { if path.is_type_relative() { @@ -184,7 +184,7 @@ impl Resolver { pub fn resolve_path_in_type_ns_fully( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, path: &Path, ) -> Option { let (res, unresolved) = self.resolve_path_in_type_ns(db, path)?; @@ -196,7 +196,7 @@ impl Resolver { pub fn resolve_path_in_value_ns<'p>( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, path: &'p Path, ) -> Option { if path.is_type_relative() { @@ -296,7 +296,7 @@ impl Resolver { pub fn resolve_path_in_value_ns_fully( &self, - db: &impl DefDatabase2, + db: &impl DefDatabase, path: &Path, ) -> Option { match self.resolve_path_in_value_ns(db, path)? { @@ -305,18 +305,18 @@ impl Resolver { } } - pub fn resolve_path_as_macro(&self, db: &impl DefDatabase2, path: &Path) -> Option { + pub fn resolve_path_as_macro(&self, db: &impl DefDatabase, path: &Path) -> Option { let (item_map, module) = self.module()?; item_map.resolve_path(db, module, path).0.get_macros() } - pub fn process_all_names(&self, db: &impl DefDatabase2, f: &mut dyn FnMut(Name, ScopeDef)) { + pub fn process_all_names(&self, db: &impl DefDatabase, f: &mut dyn FnMut(Name, ScopeDef)) { for scope in self.scopes.iter().rev() { scope.process_names(db, f); } } - pub fn traits_in_scope(&self, db: &impl DefDatabase2) -> FxHashSet { + pub fn traits_in_scope(&self, db: &impl DefDatabase) -> FxHashSet { let mut traits = FxHashSet::default(); for scope in &self.scopes { if let Scope::ModuleScope(m) = scope { @@ -378,7 +378,7 @@ pub enum ScopeDef { } impl Scope { - fn process_names(&self, db: &impl DefDatabase2, f: &mut dyn FnMut(Name, ScopeDef)) { + fn process_names(&self, db: &impl DefDatabase, f: &mut dyn FnMut(Name, ScopeDef)) { match self { Scope::ModuleScope(m) => { // FIXME: should we provide `self` here? @@ -425,17 +425,13 @@ impl Scope { } // needs arbitrary_self_types to be a method... or maybe move to the def? -pub fn resolver_for_expr( - db: &impl DefDatabase2, - owner: DefWithBodyId, - expr_id: ExprId, -) -> Resolver { +pub fn resolver_for_expr(db: &impl DefDatabase, owner: DefWithBodyId, expr_id: ExprId) -> Resolver { let scopes = db.expr_scopes(owner); resolver_for_scope(db, owner, scopes.scope_for(expr_id)) } pub fn resolver_for_scope( - db: &impl DefDatabase2, + db: &impl DefDatabase, owner: DefWithBodyId, scope_id: Option, ) -> Resolver { @@ -454,7 +450,7 @@ impl Resolver { self } - fn push_generic_params_scope(self, db: &impl DefDatabase2, def: GenericDefId) -> Resolver { + fn push_generic_params_scope(self, db: &impl DefDatabase, def: GenericDefId) -> Resolver { let params = db.generic_params(def); if params.params.is_empty() { self @@ -487,24 +483,24 @@ impl Resolver { pub trait HasResolver { /// Builds a resolver for type references inside this def. - fn resolver(self, db: &impl DefDatabase2) -> Resolver; + fn resolver(self, db: &impl DefDatabase) -> Resolver; } impl HasResolver for ModuleId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { let def_map = db.crate_def_map(self.krate); Resolver::default().push_module_scope(def_map, self.module_id) } } impl HasResolver for TraitId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { self.module(db).resolver(db).push_generic_params_scope(db, self.into()) } } impl> HasResolver for T { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { let def = self.into(); let module = match def { AdtId::StructId(it) => it.0.module(db), @@ -520,13 +516,13 @@ impl> HasResolver for T { } impl HasResolver for FunctionId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { self.lookup(db).container.resolver(db).push_generic_params_scope(db, self.into()) } } impl HasResolver for DefWithBodyId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { match self { DefWithBodyId::ConstId(c) => c.resolver(db), DefWithBodyId::FunctionId(f) => f.resolver(db), @@ -536,25 +532,25 @@ impl HasResolver for DefWithBodyId { } impl HasResolver for ConstId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { self.lookup(db).container.resolver(db) } } impl HasResolver for StaticId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { self.module(db).resolver(db) } } impl HasResolver for TypeAliasId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { self.lookup(db).container.resolver(db).push_generic_params_scope(db, self.into()) } } impl HasResolver for ContainerId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { match self { ContainerId::TraitId(it) => it.resolver(db), ContainerId::ImplId(it) => it.resolver(db), @@ -564,7 +560,7 @@ impl HasResolver for ContainerId { } impl HasResolver for GenericDefId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { match self { GenericDefId::FunctionId(inner) => inner.resolver(db), GenericDefId::AdtId(adt) => adt.resolver(db), @@ -578,7 +574,7 @@ impl HasResolver for GenericDefId { } impl HasResolver for ImplId { - fn resolver(self, db: &impl DefDatabase2) -> Resolver { + fn resolver(self, db: &impl DefDatabase) -> Resolver { self.module(db) .resolver(db) .push_generic_params_scope(db, self.into()) diff --git a/crates/ra_hir_def/src/test_db.rs b/crates/ra_hir_def/src/test_db.rs index 8ee8e40d0..439e8a412 100644 --- a/crates/ra_hir_def/src/test_db.rs +++ b/crates/ra_hir_def/src/test_db.rs @@ -12,7 +12,7 @@ use ra_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath ra_db::SourceDatabaseStorage, hir_expand::db::AstDatabaseStorage, crate::db::InternDatabaseStorage, - crate::db::DefDatabase2Storage + crate::db::DefDatabaseStorage )] #[derive(Debug, Default)] pub struct TestDB { -- cgit v1.2.3