Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-def/src/db.rs67
-rw-r--r--crates/hir-def/src/expr_store/lower.rs2
-rw-r--r--crates/hir-ty/src/drop.rs6
3 files changed, 7 insertions, 68 deletions
diff --git a/crates/hir-def/src/db.rs b/crates/hir-def/src/db.rs
index 2ad0a9a8c8..11e5c54246 100644
--- a/crates/hir-def/src/db.rs
+++ b/crates/hir-def/src/db.rs
@@ -7,77 +7,16 @@ use hir_expand::{
use triomphe::Arc;
use crate::{
- AssocItemId, AttrDefId, BlockId, BlockLoc, ConstId, ConstLoc, EnumId, EnumLoc, EnumVariantId,
- EnumVariantLoc, ExternBlockId, ExternBlockLoc, ExternCrateId, ExternCrateLoc, FunctionId,
- FunctionLoc, ImplId, ImplLoc, Macro2Id, Macro2Loc, MacroExpander, MacroId, MacroRulesId,
- MacroRulesLoc, MacroRulesLocFlags, ProcMacroId, ProcMacroLoc, StaticId, StaticLoc, StructId,
- StructLoc, TraitId, TraitLoc, TypeAliasId, TypeAliasLoc, UnionId, UnionLoc, UseId, UseLoc,
+ AssocItemId, AttrDefId, Macro2Loc, MacroExpander, MacroId, MacroRulesLoc, MacroRulesLocFlags,
+ TraitId,
attrs::AttrFlags,
item_tree::{ItemTree, file_item_tree},
nameres::crate_def_map,
visibility::{self, Visibility},
};
-use salsa::plumbing::AsId;
-
-#[query_group::query_group(InternDatabaseStorage)]
-pub trait InternDatabase: SourceDatabase {
- // region: items
- #[salsa::interned]
- fn intern_use(&self, loc: UseLoc) -> UseId;
-
- #[salsa::interned]
- fn intern_extern_crate(&self, loc: ExternCrateLoc) -> ExternCrateId;
-
- #[salsa::interned]
- fn intern_function(&self, loc: FunctionLoc) -> FunctionId;
-
- #[salsa::interned]
- fn intern_struct(&self, loc: StructLoc) -> StructId;
-
- #[salsa::interned]
- fn intern_union(&self, loc: UnionLoc) -> UnionId;
-
- #[salsa::interned]
- fn intern_enum(&self, loc: EnumLoc) -> EnumId;
-
- #[salsa::interned]
- fn intern_enum_variant(&self, loc: EnumVariantLoc) -> EnumVariantId;
-
- #[salsa::interned]
- fn intern_const(&self, loc: ConstLoc) -> ConstId;
-
- #[salsa::interned]
- fn intern_static(&self, loc: StaticLoc) -> StaticId;
-
- #[salsa::interned]
- fn intern_trait(&self, loc: TraitLoc) -> TraitId;
-
- #[salsa::interned]
- fn intern_type_alias(&self, loc: TypeAliasLoc) -> TypeAliasId;
-
- #[salsa::interned]
- fn intern_impl(&self, loc: ImplLoc) -> ImplId;
-
- #[salsa::interned]
- fn intern_extern_block(&self, loc: ExternBlockLoc) -> ExternBlockId;
-
- #[salsa::interned]
- fn intern_macro2(&self, loc: Macro2Loc) -> Macro2Id;
-
- #[salsa::interned]
- fn intern_proc_macro(&self, loc: ProcMacroLoc) -> ProcMacroId;
-
- #[salsa::interned]
- fn intern_macro_rules(&self, loc: MacroRulesLoc) -> MacroRulesId;
- // endregion: items
-
- #[salsa::interned]
- fn intern_block(&self, loc: BlockLoc) -> BlockId;
-}
-
#[query_group::query_group]
-pub trait DefDatabase: InternDatabase + ExpandDatabase + SourceDatabase {
+pub trait DefDatabase: ExpandDatabase + SourceDatabase {
/// Whether to expand procedural macros during name resolution.
#[salsa::input]
fn expand_proc_attr_macros(&self) -> bool;
diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs
index bd1dff8757..d2e4eac8bb 100644
--- a/crates/hir-def/src/expr_store/lower.rs
+++ b/crates/hir-def/src/expr_store/lower.rs
@@ -2499,7 +2499,7 @@ impl<'db> ExprCollector<'db> {
) -> ExprId {
let block_id = self.expander.ast_id_map().ast_id_for_block(&block).map(|file_local_id| {
let ast_id = self.expander.in_file(file_local_id);
- self.db.intern_block(BlockLoc { ast_id, module: self.module })
+ BlockId::new(self.db, BlockLoc { ast_id, module: self.module })
});
let (module, def_map) =
diff --git a/crates/hir-ty/src/drop.rs b/crates/hir-ty/src/drop.rs
index d4a948c7b2..61e6720a29 100644
--- a/crates/hir-ty/src/drop.rs
+++ b/crates/hir-ty/src/drop.rs
@@ -22,9 +22,9 @@ use crate::{
#[salsa::tracked]
pub fn destructor(db: &dyn HirDatabase, adt: AdtId) -> Option<ImplId> {
let module = match adt {
- AdtId::EnumId(id) => db.lookup_intern_enum(id).container,
- AdtId::StructId(id) => db.lookup_intern_struct(id).container,
- AdtId::UnionId(id) => db.lookup_intern_union(id).container,
+ AdtId::EnumId(id) => id.loc(db).container,
+ AdtId::StructId(id) => id.loc(db).container,
+ AdtId::UnionId(id) => id.loc(db).container,
};
let interner = DbInterner::new_with(db, module.krate(db));
let drop_trait = interner.lang_items().Drop?;