diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-04 13:58:41 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-04 13:58:41 +0000 |
commit | a0d483011d5f84747fcc5d5fe9c82f4405d24db9 (patch) | |
tree | 25bc6aab1e4328e73446876b274e7dcaff7aa915 /crates/ra_hir/src/ids.rs | |
parent | 821fa7a50ab8c4886adc60a2093aa8e06cc3a9d6 (diff) | |
parent | 3fe6f422f9ef13b9171dbeab0c5c427f729f9983 (diff) |
Merge #425
425: remove id arena r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 12 |
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 @@ | |||
1 | use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; | 1 | use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; |
2 | use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, SourceFile, AstNode, ast}; | 2 | use ra_syntax::{SourceFileNode, SyntaxKind, SyntaxNode, SyntaxNodeRef, SourceFile, AstNode, ast}; |
3 | use ra_arena::{Arena, RawId, impl_arena_id}; | ||
3 | 4 | ||
4 | use crate::{ | 5 | use 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. |
209 | pub(crate) type SourceFileItemId = Id<SyntaxNode>; | 207 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
208 | pub struct SourceFileItemId(RawId); | ||
209 | impl_arena_id!(SourceFileItemId); | ||
210 | 210 | ||
211 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 211 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
212 | pub struct SourceItemId { | 212 | pub struct SourceItemId { |
@@ -219,7 +219,7 @@ pub struct SourceItemId { | |||
219 | #[derive(Debug, PartialEq, Eq)] | 219 | #[derive(Debug, PartialEq, Eq)] |
220 | pub struct SourceFileItems { | 220 | pub struct SourceFileItems { |
221 | file_id: HirFileId, | 221 | file_id: HirFileId, |
222 | arena: Arena<SyntaxNode>, | 222 | arena: Arena<SourceFileItemId, SyntaxNode>, |
223 | } | 223 | } |
224 | 224 | ||
225 | impl SourceFileItems { | 225 | impl SourceFileItems { |