From 3fe6f422f9ef13b9171dbeab0c5c427f729f9983 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 4 Jan 2019 16:15:50 +0300 Subject: remove id arena --- crates/ra_hir/src/module.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/module.rs') diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs index a53b69d20..c70dc54dd 100644 --- a/crates/ra_hir/src/module.rs +++ b/crates/ra_hir/src/module.rs @@ -9,6 +9,7 @@ use ra_syntax::{ ast::{self, AstNode, NameOwner}, SyntaxNode, }; +use ra_arena::{Arena, RawId, impl_arena_id}; use ra_db::{SourceRootId, FileId, Cancelable}; use relative_path::RelativePathBuf; @@ -16,7 +17,6 @@ use crate::{ Def, DefKind, DefLoc, DefId, Name, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId, Crate, HirFileId, - arena::{Arena, Id}, }; pub use self::nameres::{ModuleScope, Resolution, Namespace, PerNs}; @@ -173,6 +173,14 @@ impl Module { } } +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct ModuleId(RawId); +impl_arena_id!(ModuleId); + +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct LinkId(RawId); +impl_arena_id!(LinkId); + /// Physically, rust source is organized as a set of files, but logically it is /// organized as a tree of modules. Usually, a single file corresponds to a /// single module, but it is not nessary the case. @@ -182,8 +190,8 @@ impl Module { /// always have one parent). #[derive(Default, Debug, PartialEq, Eq)] pub struct ModuleTree { - mods: Arena, - links: Arena, + mods: Arena, + links: Arena, } impl ModuleTree { @@ -210,9 +218,6 @@ pub(crate) enum ModuleSourceNode { Module(ast::ModuleNode), } -pub type ModuleId = Id; -type LinkId = Id; - #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub enum Problem { UnresolvedModule { -- cgit v1.2.3