diff options
Diffstat (limited to 'crates/ra_hir_expand/src/lib.rs')
-rw-r--r-- | crates/ra_hir_expand/src/lib.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 749227465..6b3538673 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs | |||
@@ -14,19 +14,6 @@ use ra_syntax::ast::{self, AstNode}; | |||
14 | 14 | ||
15 | use crate::{ast_id_map::FileAstId, db::AstDatabase}; | 15 | use crate::{ast_id_map::FileAstId, db::AstDatabase}; |
16 | 16 | ||
17 | macro_rules! impl_intern_key { | ||
18 | ($name:ident) => { | ||
19 | impl salsa::InternKey for $name { | ||
20 | fn from_intern_id(v: salsa::InternId) -> Self { | ||
21 | $name(v) | ||
22 | } | ||
23 | fn as_intern_id(&self) -> salsa::InternId { | ||
24 | self.0 | ||
25 | } | ||
26 | } | ||
27 | }; | ||
28 | } | ||
29 | |||
30 | /// Input to the analyzer is a set of files, where each file is identified by | 17 | /// Input to the analyzer is a set of files, where each file is identified by |
31 | /// `FileId` and contains source code. However, another source of source code in | 18 | /// `FileId` and contains source code. However, another source of source code in |
32 | /// Rust are macros: each macro can be thought of as producing a "temporary | 19 | /// Rust are macros: each macro can be thought of as producing a "temporary |
@@ -101,7 +88,14 @@ pub enum MacroFileKind { | |||
101 | /// `println!("Hello, {}", world)`. | 88 | /// `println!("Hello, {}", world)`. |
102 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 89 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
103 | pub struct MacroCallId(salsa::InternId); | 90 | pub struct MacroCallId(salsa::InternId); |
104 | impl_intern_key!(MacroCallId); | 91 | impl salsa::InternKey for MacroCallId { |
92 | fn from_intern_id(v: salsa::InternId) -> Self { | ||
93 | MacroCallId(v) | ||
94 | } | ||
95 | fn as_intern_id(&self) -> salsa::InternId { | ||
96 | self.0 | ||
97 | } | ||
98 | } | ||
105 | 99 | ||
106 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 100 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
107 | pub struct MacroDefId { | 101 | pub struct MacroDefId { |