aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ids.rs
diff options
context:
space:
mode:
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 {