diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs index cc9a2fdf4c..e1bf6fde8a 100644 --- a/crates/hir-def/src/attr.rs +++ b/crates/hir-def/src/attr.rs @@ -523,15 +523,10 @@ impl AttrsWithOwner { let mod_data = &def_map[module.local_id]; let raw_attrs = match mod_data.origin { - ModuleOrigin::File { - definition, - declaration_tree_id, - file_item_tree_id, - .. - } => { + ModuleOrigin::File { definition, declaration_tree_id, declaration, .. } => { let decl_attrs = declaration_tree_id .item_tree(db) - .raw_attrs(AttrOwner::ModItem(file_item_tree_id.into())) + .raw_attrs(AttrOwner::ModItem(declaration.into())) .clone(); let tree = db.file_item_tree(definition.into()); let def_attrs = tree.raw_attrs(AttrOwner::TopLevel).clone(); @@ -541,12 +536,10 @@ impl AttrsWithOwner { let tree = db.file_item_tree(definition.into()); tree.raw_attrs(AttrOwner::TopLevel).clone() } - ModuleOrigin::Inline { definition_tree_id, file_item_tree_id, .. } => { - definition_tree_id - .item_tree(db) - .raw_attrs(AttrOwner::ModItem(file_item_tree_id.into())) - .clone() - } + ModuleOrigin::Inline { definition_tree_id, definition } => definition_tree_id + .item_tree(db) + .raw_attrs(AttrOwner::ModItem(definition.into())) + .clone(), ModuleOrigin::BlockExpr { id, .. } => { let tree = db.block_item_tree(id); tree.raw_attrs(AttrOwner::TopLevel).clone() diff --git a/crates/hir-def/src/item_tree.rs b/crates/hir-def/src/item_tree.rs index ec2b65c9c0..578f5fdee2 100644 --- a/crates/hir-def/src/item_tree.rs +++ b/crates/hir-def/src/item_tree.rs @@ -37,8 +37,8 @@ mod tests; use std::{ fmt::{self, Debug}, - hash::{Hash, Hasher}, - ops::{Index, Range}, + hash::Hash, + ops::Index, sync::OnceLock, }; @@ -51,7 +51,7 @@ use hir_expand::{ name::Name, }; use intern::Interned; -use la_arena::{Arena, Idx, RawIdx}; +use la_arena::{Arena, Idx}; use rustc_hash::FxHashMap; use smallvec::SmallVec; use span::{AstIdNode, Edition, FileAstId, SyntaxContext}; @@ -277,23 +277,23 @@ struct ItemVisibilities { #[derive(Default, Debug, Eq, PartialEq)] struct ItemTreeData { - uses: Arena, - extern_crates: Arena, - extern_blocks: Arena, - functions: Arena, - structs: Arena, - unions: Arena, - enums: Arena, - consts: Arena, - statics: Arena, - traits: Arena, - trait_aliases: Arena, - impls: Arena, - type_aliases: Arena, - mods: Arena, - macro_calls: Arena, - macro_rules: Arena, - macro_defs: Arena, + uses: FxHashMap, Use>, + extern_crates: FxHashMap, ExternCrate>, + extern_blocks: FxHashMap, ExternBlock>, + functions: FxHashMap, Function>, + structs: FxHashMap, Struct>, + unions: FxHashMap, Union>, + enums: FxHashMap, Enum>, + consts: FxHashMap, Const>, + statics: FxHashMap, Static>, + traits: FxHashMap, Trait>, + trait_aliases: FxHashMap, TraitAlias>, + impls: FxHashMap, Impl>, + type_aliases: FxHashMap, TypeAlias>, + mods: FxHashMap, Mod>, + macro_calls: FxHashMap, MacroCall>, + macro_rules: FxHashMap, MacroRules>, + macro_defs: FxHashMap, Macro2>, vis: ItemVisibilities, } @@ -329,51 +329,11 @@ pub trait ItemTreeNode: Clone { fn ast_id(&self) -> FileAstId; /// Looks up an instance of `Self` in an item tree. - fn lookup(tree: &ItemTree, index: Idx) -> &Self; + fn lookup(tree: &ItemTree, index: FileAstId) -> &Self; } -pub struct FileItemTreeId(Idx); - -impl FileItemTreeId { - pub fn range_iter(range: Range) -> impl Iterator + Clone { - (range.start.index().into_raw().into_u32()..range.end.index().into_raw().into_u32()) - .map(RawIdx::from_u32) - .map(Idx::from_raw) - .map(Self) - } -} - -impl FileItemTreeId { - pub fn index(&self) -> Idx { - self.0 - } -} - -impl Clone for FileItemTreeId { - fn clone(&self) -> Self { - *self - } -} -impl Copy for FileItemTreeId {} - -impl PartialEq for FileItemTreeId { - fn eq(&self, other: &FileItemTreeId) -> bool { - self.0 == other.0 - } -} -impl Eq for FileItemTreeId {} - -impl Hash for FileItemTreeId { - fn hash(&self, state: &mut H) { - self.0.hash(state) - } -} - -impl fmt::Debug for FileItemTreeId { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0.fmt(f) - } -} +#[allow(type_alias_bounds)] +pub type ItemTreeAstId = FileAstId; /// Identifies a particular [`ItemTree`]. #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] @@ -409,21 +369,21 @@ macro_rules! mod_items { #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum ModItem { $( - $typ(FileItemTreeId<$typ>), + $typ(FileAstId<$ast>), )+ } impl ModItem { - pub fn ast_id(&self, tree: &ItemTree) -> FileAstId { + pub fn ast_id(self) -> FileAstId { match self { - $(ModItem::$typ(it) => tree[it.index()].ast_id().upcast()),+ + $(ModItem::$typ(it) => it.upcast()),+ } } } $( - impl From> for ModItem { - fn from(id: FileItemTreeId<$typ>) -> ModItem { + impl From> for ModItem { + fn from(id: FileAstId<$ast>) -> ModItem { ModItem::$typ(id) } } @@ -433,20 +393,20 @@ macro_rules! mod_items { impl ItemTreeNode for $typ { type Source = $ast; - fn ast_id(&self) -> FileAstId { + fn ast_id(&self) -> FileAstId<$ast> { self.ast_id } - fn lookup(tree: &ItemTree, index: Idx) -> &Self { - &tree.data().$fld[index] + fn lookup(tree: &ItemTree, index: FileAstId<$ast>) -> &Self { + &tree.data().$fld[&index] } } - impl Index> for ItemTree { + impl Index> for ItemTree { type Output = $typ; - fn index(&self, index: Idx<$typ>) -> &Self::Output { - &self.data().$fld[index] + fn index(&self, index: FileAstId<$ast>) -> &Self::Output { + &self.data().$fld[&index] } } )+ @@ -506,13 +466,6 @@ impl Index for ItemTree { } } -impl Index> for ItemTree { - type Output = N; - fn index(&self, id: FileItemTreeId) -> &N { - N::lookup(self, id.index()) - } -} - #[derive(Debug, Clone, Eq, PartialEq)] pub struct Use { pub visibility: RawVisibilityId, diff --git a/crates/hir-def/src/item_tree/lower.rs b/crates/hir-def/src/item_tree/lower.rs index 26d209c972..17b115b6ec 100644 --- a/crates/hir-def/src/item_tree/lower.rs +++ b/crates/hir-def/src/item_tree/lower.rs @@ -20,18 +20,14 @@ use triomphe::Arc; use crate::{ db::DefDatabase, item_tree::{ - AttrOwner, Const, Enum, ExternBlock, ExternCrate, FieldsShape, FileItemTreeId, Function, - Idx, Impl, ImportAlias, Interned, ItemTree, ItemTreeData, Macro2, MacroCall, MacroRules, - Mod, ModItem, ModKind, ModPath, RawAttrs, RawVisibility, RawVisibilityId, Static, Struct, + AttrOwner, Const, Enum, ExternBlock, ExternCrate, FieldsShape, Function, Impl, ImportAlias, + Interned, ItemTree, ItemTreeAstId, ItemTreeData, Macro2, MacroCall, MacroRules, Mod, + ModItem, ModKind, ModPath, RawAttrs, RawVisibility, RawVisibilityId, Static, Struct, StructKind, Trait, TraitAlias, TypeAlias, Union, Use, UseTree, UseTreeKind, VisibilityExplicitness, }, }; -fn id(index: Idx) -> FileItemTreeId { - FileItemTreeId(index) -} - pub(super) struct Ctx<'a> { db: &'a dyn DefDatabase, tree: ItemTree, @@ -173,36 +169,36 @@ impl<'a> Ctx<'a> { } } - fn lower_struct(&mut self, strukt: &ast::Struct) -> Option> { + fn lower_struct(&mut self, strukt: &ast::Struct) -> Option> { let visibility = self.lower_visibility(strukt); let name = strukt.name()?.as_name(); let ast_id = self.source_ast_id_map.ast_id(strukt); let shape = adt_shape(strukt.kind()); let res = Struct { name, visibility, shape, ast_id }; - let id = id(self.data().structs.alloc(res)); + self.data().structs.insert(ast_id, res); - Some(id) + Some(ast_id) } - fn lower_union(&mut self, union: &ast::Union) -> Option> { + fn lower_union(&mut self, union: &ast::Union) -> Option> { let visibility = self.lower_visibility(union); let name = union.name()?.as_name(); let ast_id = self.source_ast_id_map.ast_id(union); let res = Union { name, visibility, ast_id }; - let id = id(self.data().unions.alloc(res)); - Some(id) + self.data().unions.insert(ast_id, res); + Some(ast_id) } - fn lower_enum(&mut self, enum_: &ast::Enum) -> Option> { + fn lower_enum(&mut self, enum_: &ast::Enum) -> Option> { let visibility = self.lower_visibility(enum_); let name = enum_.name()?.as_name(); let ast_id = self.source_ast_id_map.ast_id(enum_); let res = Enum { name, visibility, ast_id }; - let id = id(self.data().enums.alloc(res)); - Some(id) + self.data().enums.insert(ast_id, res); + Some(ast_id) } - fn lower_function(&mut self, func: &ast::Fn) -> Option> { + fn lower_function(&mut self, func: &ast::Fn) -> Option> { let visibility = self.lower_visibility(func); let name = func.name()?.as_name(); @@ -210,39 +206,41 @@ impl<'a> Ctx<'a> { let res = Function { name, visibility, ast_id }; - let id = id(self.data().functions.alloc(res)); - Some(id) + self.data().functions.insert(ast_id, res); + Some(ast_id) } fn lower_type_alias( &mut self, type_alias: &ast::TypeAlias, - ) -> Option> { + ) -> Option> { let name = type_alias.name()?.as_name(); let visibility = self.lower_visibility(type_alias); let ast_id = self.source_ast_id_map.ast_id(type_alias); let res = TypeAlias { name, visibility, ast_id }; - let id = id(self.data().type_aliases.alloc(res)); - Some(id) + self.data().type_aliases.insert(ast_id, res); + Some(ast_id) } - fn lower_static(&mut self, static_: &ast::Static) -> Option> { + fn lower_static(&mut self, static_: &ast::Static) -> Option> { let name = static_.name()?.as_name(); let visibility = self.lower_visibility(static_); let ast_id = self.source_ast_id_map.ast_id(static_); let res = Static { name, visibility, ast_id }; - Some(id(self.data().statics.alloc(res))) + self.data().statics.insert(ast_id, res); + Some(ast_id) } - fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId { + fn lower_const(&mut self, konst: &ast::Const) -> ItemTreeAstId { let name = konst.name().map(|it| it.as_name()); let visibility = self.lower_visibility(konst); let ast_id = self.source_ast_id_map.ast_id(konst); let res = Const { name, visibility, ast_id }; - id(self.data().consts.alloc(res)) + self.data().consts.insert(ast_id, res); + ast_id } - fn lower_module(&mut self, module: &ast::Module) -> Option> { + fn lower_module(&mut self, module: &ast::Module) -> Option> { let name = module.name()?.as_name(); let visibility = self.lower_visibility(module); let kind = if module.semicolon_token().is_some() { @@ -260,41 +258,43 @@ impl<'a> Ctx<'a> { }; let ast_id = self.source_ast_id_map.ast_id(module); let res = Mod { name, visibility, kind, ast_id }; - Some(id(self.data().mods.alloc(res))) + self.data().mods.insert(ast_id, res); + Some(ast_id) } - fn lower_trait(&mut self, trait_def: &ast::Trait) -> Option> { + fn lower_trait(&mut self, trait_def: &ast::Trait) -> Option> { let name = trait_def.name()?.as_name(); let visibility = self.lower_visibility(trait_def); let ast_id = self.source_ast_id_map.ast_id(trait_def); let def = Trait { name, visibility, ast_id }; - let id = id(self.data().traits.alloc(def)); - Some(id) + self.data().traits.insert(ast_id, def); + Some(ast_id) } fn lower_trait_alias( &mut self, trait_alias_def: &ast::TraitAlias, - ) -> Option> { + ) -> Option> { let name = trait_alias_def.name()?.as_name(); let visibility = self.lower_visibility(trait_alias_def); let ast_id = self.source_ast_id_map.ast_id(trait_alias_def); let alias = TraitAlias { name, visibility, ast_id }; - let id = id(self.data().trait_aliases.alloc(alias)); - Some(id) + self.data().trait_aliases.insert(ast_id, alias); + Some(ast_id) } - fn lower_impl(&mut self, impl_def: &ast::Impl) -> FileItemTreeId { + fn lower_impl(&mut self, impl_def: &ast::Impl) -> ItemTreeAstId { let ast_id = self.source_ast_id_map.ast_id(impl_def); // Note that trait impls don't get implicit `Self` unlike traits, because here they are a // type alias rather than a type parameter, so this is handled by the resolver. let res = Impl { ast_id }; - id(self.data().impls.alloc(res)) + self.data().impls.insert(ast_id, res); + ast_id } - fn lower_use(&mut self, use_item: &ast::Use) -> Option> { + fn lower_use(&mut self, use_item: &ast::Use) -> Option> { let visibility = self.lower_visibility(use_item); let ast_id = self.source_ast_id_map.ast_id(use_item); let (use_tree, _) = lower_use_tree(self.db, use_item.use_tree()?, &mut |range| { @@ -302,13 +302,14 @@ impl<'a> Ctx<'a> { })?; let res = Use { visibility, ast_id, use_tree }; - Some(id(self.data().uses.alloc(res))) + self.data().uses.insert(ast_id, res); + Some(ast_id) } fn lower_extern_crate( &mut self, extern_crate: &ast::ExternCrate, - ) -> Option> { + ) -> Option> { let name = extern_crate.name_ref()?.as_name(); let alias = extern_crate.rename().map(|a| { a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) @@ -317,10 +318,11 @@ impl<'a> Ctx<'a> { let ast_id = self.source_ast_id_map.ast_id(extern_crate); let res = ExternCrate { name, alias, visibility, ast_id }; - Some(id(self.data().extern_crates.alloc(res))) + self.data().extern_crates.insert(ast_id, res); + Some(ast_id) } - fn lower_macro_call(&mut self, m: &ast::MacroCall) -> Option> { + fn lower_macro_call(&mut self, m: &ast::MacroCall) -> Option> { let span_map = self.span_map(); let path = m.path()?; let range = path.syntax().text_range(); @@ -330,28 +332,31 @@ impl<'a> Ctx<'a> { let ast_id = self.source_ast_id_map.ast_id(m); let expand_to = hir_expand::ExpandTo::from_call_site(m); let res = MacroCall { path, ast_id, expand_to, ctxt: span_map.span_for_range(range).ctx }; - Some(id(self.data().macro_calls.alloc(res))) + self.data().macro_calls.insert(ast_id, res); + Some(ast_id) } - fn lower_macro_rules(&mut self, m: &ast::MacroRules) -> Option> { + fn lower_macro_rules(&mut self, m: &ast::MacroRules) -> Option> { let name = m.name()?; let ast_id = self.source_ast_id_map.ast_id(m); let res = MacroRules { name: name.as_name(), ast_id }; - Some(id(self.data().macro_rules.alloc(res))) + self.data().macro_rules.insert(ast_id, res); + Some(ast_id) } - fn lower_macro_def(&mut self, m: &ast::MacroDef) -> Option> { + fn lower_macro_def(&mut self, m: &ast::MacroDef) -> Option> { let name = m.name()?; let ast_id = self.source_ast_id_map.ast_id(m); let visibility = self.lower_visibility(m); let res = Macro2 { name: name.as_name(), ast_id, visibility }; - Some(id(self.data().macro_defs.alloc(res))) + self.data().macro_defs.insert(ast_id, res); + Some(ast_id) } - fn lower_extern_block(&mut self, block: &ast::ExternBlock) -> FileItemTreeId { + fn lower_extern_block(&mut self, block: &ast::ExternBlock) -> ItemTreeAstId { let ast_id = self.source_ast_id_map.ast_id(block); let children: Box<[_]> = block.extern_item_list().map_or(Box::new([]), |list| { list.extern_items() @@ -374,7 +379,8 @@ impl<'a> Ctx<'a> { }); let res = ExternBlock { ast_id, children }; - id(self.data().extern_blocks.alloc(res)) + self.data().extern_blocks.insert(ast_id, res); + ast_id } fn lower_visibility(&mut self, item: &dyn ast::HasVisibility) -> RawVisibilityId { diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs index e62fd3dab7..610bb6b00b 100644 --- a/crates/hir-def/src/nameres.rs +++ b/crates/hir-def/src/nameres.rs @@ -80,7 +80,7 @@ use crate::{ LocalModuleId, Lookup, MacroExpander, MacroId, ModuleId, ProcMacroId, UseId, db::DefDatabase, item_scope::{BuiltinShadowMode, ItemScope}, - item_tree::{FileItemTreeId, Mod, TreeId}, + item_tree::TreeId, nameres::{diagnostics::DefDiagnostic, path_resolution::ResolveMode}, per_ns::PerNs, visibility::{Visibility, VisibilityExplicitness}, @@ -290,12 +290,10 @@ pub enum ModuleOrigin { is_mod_rs: bool, declaration: FileAstId, declaration_tree_id: TreeId, - file_item_tree_id: FileItemTreeId, definition: EditionedFileId, }, Inline { definition_tree_id: TreeId, - file_item_tree_id: FileItemTreeId, definition: FileAstId, }, /// Pseudo-module introduced by a block scope (contains only inner items). @@ -311,7 +309,7 @@ impl ModuleOrigin { &ModuleOrigin::File { declaration, declaration_tree_id, .. } => { Some(AstId::new(declaration_tree_id.file_id(), declaration)) } - &ModuleOrigin::Inline { definition, definition_tree_id, file_item_tree_id: _ } => { + &ModuleOrigin::Inline { definition, definition_tree_id } => { Some(AstId::new(definition_tree_id.file_id(), definition)) } ModuleOrigin::CrateRoot { .. } | ModuleOrigin::BlockExpr { .. } => None, @@ -343,14 +341,12 @@ impl ModuleOrigin { let sf = db.parse(editioned_file_id).tree(); InFile::new(editioned_file_id.into(), ModuleSource::SourceFile(sf)) } - &ModuleOrigin::Inline { definition, definition_tree_id, file_item_tree_id: _ } => { - InFile::new( - definition_tree_id.file_id(), - ModuleSource::Module( - AstId::new(definition_tree_id.file_id(), definition).to_node(db), - ), - ) - } + &ModuleOrigin::Inline { definition, definition_tree_id } => InFile::new( + definition_tree_id.file_id(), + ModuleSource::Module( + AstId::new(definition_tree_id.file_id(), definition).to_node(db), + ), + ), ModuleOrigin::BlockExpr { block, .. } => { InFile::new(block.file_id, ModuleSource::BlockExpr(block.to_node(db))) } @@ -777,12 +773,10 @@ impl ModuleData { ErasedAstId::new(definition.into(), ROOT_ERASED_FILE_AST_ID).to_range(db), ) } - &ModuleOrigin::Inline { definition, definition_tree_id, file_item_tree_id: _ } => { - InFile::new( - definition_tree_id.file_id(), - AstId::new(definition_tree_id.file_id(), definition).to_range(db), - ) - } + &ModuleOrigin::Inline { definition, definition_tree_id } => InFile::new( + definition_tree_id.file_id(), + AstId::new(definition_tree_id.file_id(), definition).to_range(db), + ), ModuleOrigin::BlockExpr { block, .. } => InFile::new(block.file_id, block.to_range(db)), } } diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs index e2231857fd..a8ee92d813 100644 --- a/crates/hir-def/src/nameres/collector.rs +++ b/crates/hir-def/src/nameres/collector.rs @@ -35,7 +35,7 @@ use crate::{ db::DefDatabase, item_scope::{GlobId, ImportId, ImportOrExternCrate, PerNsGlobImports}, item_tree::{ - self, FieldsShape, FileItemTreeId, ImportAlias, ImportKind, ItemTree, ItemTreeNode, Macro2, + self, FieldsShape, ImportAlias, ImportKind, ItemTree, ItemTreeAstId, ItemTreeNode, Macro2, MacroCall, MacroRules, Mod, ModItem, ModKind, TreeId, UseTreeKind, }, macro_call_as_call_id, @@ -141,7 +141,7 @@ struct ImportSource { is_prelude: bool, kind: ImportKind, tree: TreeId, - item: FileItemTreeId, + item: FileAstId, } #[derive(Debug, Eq, PartialEq)] @@ -156,7 +156,7 @@ impl Import { fn from_use( tree: &ItemTree, tree_id: TreeId, - item: FileItemTreeId, + item: FileAstId, id: UseId, is_prelude: bool, mut cb: impl FnMut(Self), @@ -2084,7 +2084,7 @@ impl ModCollector<'_, '_> { ); } - fn collect_module(&mut self, module_id: FileItemTreeId, attrs: &Attrs) { + fn collect_module(&mut self, module_id: ItemTreeAstId, attrs: &Attrs) { let path_attr = attrs.by_key(sym::path).string_value_unescape(); let is_macro_use = attrs.by_key(sym::macro_use).exists(); let module = &self.item_tree[module_id]; @@ -2096,7 +2096,6 @@ impl ModCollector<'_, '_> { module.ast_id, None, &self.item_tree[module.visibility], - module_id, ); let Some(mod_dir) = @@ -2151,7 +2150,6 @@ impl ModCollector<'_, '_> { ast_id.value, Some((file_id, is_mod_rs)), &self.item_tree[module.visibility], - module_id, ); ModCollector { def_collector: self.def_collector, @@ -2179,7 +2177,6 @@ impl ModCollector<'_, '_> { ast_id.value, None, &self.item_tree[module.visibility], - module_id, ); self.def_collector.def_map.diagnostics.push( DefDiagnostic::unresolved_module(self.module_id, ast_id, candidates), @@ -2196,7 +2193,6 @@ impl ModCollector<'_, '_> { declaration: FileAstId, definition: Option<(EditionedFileId, bool)>, visibility: &crate::visibility::RawVisibility, - mod_tree_id: FileItemTreeId, ) -> LocalModuleId { let def_map = &mut self.def_collector.def_map; let vis = def_map @@ -2209,17 +2205,14 @@ impl ModCollector<'_, '_> { ) .unwrap_or(Visibility::Public); let origin = match definition { - None => ModuleOrigin::Inline { - definition: declaration, - definition_tree_id: self.tree_id, - file_item_tree_id: mod_tree_id, - }, + None => { + ModuleOrigin::Inline { definition: declaration, definition_tree_id: self.tree_id } + } Some((definition, is_mod_rs)) => ModuleOrigin::File { declaration, definition, is_mod_rs, declaration_tree_id: self.tree_id, - file_item_tree_id: mod_tree_id, }, }; @@ -2294,11 +2287,7 @@ impl ModCollector<'_, '_> { attr.path.display(self.def_collector.db, Edition::LATEST) ); - let ast_id = AstIdWithPath::new( - self.file_id(), - mod_item.ast_id(self.item_tree), - attr.path.clone(), - ); + let ast_id = AstIdWithPath::new(self.file_id(), mod_item.ast_id(), attr.path.clone()); self.def_collector.unresolved_macros.push(MacroDirective { module_id: self.module_id, depth: self.macro_depth + 1, @@ -2317,7 +2306,7 @@ impl ModCollector<'_, '_> { Ok(()) } - fn collect_macro_rules(&mut self, id: FileItemTreeId, module: ModuleId) { + fn collect_macro_rules(&mut self, id: ItemTreeAstId, module: ModuleId) { let krate = self.def_collector.def_map.krate; let mac = &self.item_tree[id]; let attrs = self.item_tree.attrs(self.def_collector.db, krate, ModItem::from(id).into()); @@ -2402,7 +2391,7 @@ impl ModCollector<'_, '_> { ); } - fn collect_macro_def(&mut self, id: FileItemTreeId, module: ModuleId) { + fn collect_macro_def(&mut self, id: ItemTreeAstId, module: ModuleId) { let krate = self.def_collector.def_map.krate; let mac = &self.item_tree[id]; let ast_id = InFile::new(self.file_id(), mac.ast_id.upcast());