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