aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ids.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-04 13:15:50 +0000
committerAleksey Kladov <[email protected]>2019-01-04 13:58:10 +0000
commit3fe6f422f9ef13b9171dbeab0c5c427f729f9983 (patch)
tree25bc6aab1e4328e73446876b274e7dcaff7aa915 /crates/ra_hir/src/ids.rs
parent291d578938d7dc9b1f9bbd1174e444cc831531d9 (diff)
remove id arena
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r--crates/ra_hir/src/ids.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 4c7ebe3ea..66adacc7d 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -1,10 +1,8 @@
1use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; 1use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId};
2use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, SourceFile, AstNode, ast}; 2use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, SourceFile, AstNode, ast};
3use ra_arena::{Arena, RawId, impl_arena_id};
3 4
4use crate::{ 5use crate::{HirDatabase, PerNs, ModuleId, Module, Def, Function, Struct, Enum};
5 HirDatabase, PerNs, ModuleId, Module, Def, Function, Struct, Enum,
6 arena::{Arena, Id},
7};
8 6
9/// hir makes a heavy use of ids: integer (u32) handlers to various things. You 7/// hir makes a heavy use of ids: integer (u32) handlers to various things. You
10/// can think of id as a pointer (but without a lifetime) or a file descriptor 8/// can think of id as a pointer (but without a lifetime) or a file descriptor
@@ -206,7 +204,9 @@ impl DefKind {
206 204
207/// Identifier of item within a specific file. This is stable over reparses, so 205/// Identifier of item within a specific file. This is stable over reparses, so
208/// it's OK to use it as a salsa key/value. 206/// it's OK to use it as a salsa key/value.
209pub(crate) type SourceFileItemId = Id<SyntaxNode>; 207#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
208pub struct SourceFileItemId(RawId);
209impl_arena_id!(SourceFileItemId);
210 210
211#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 211#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
212pub struct SourceItemId { 212pub struct SourceItemId {
@@ -219,7 +219,7 @@ pub struct SourceItemId {
219#[derive(Debug, PartialEq, Eq)] 219#[derive(Debug, PartialEq, Eq)]
220pub struct SourceFileItems { 220pub struct SourceFileItems {
221 file_id: HirFileId, 221 file_id: HirFileId,
222 arena: Arena<SyntaxNode>, 222 arena: Arena<SourceFileItemId, SyntaxNode>,
223} 223}
224 224
225impl SourceFileItems { 225impl SourceFileItems {