diff options
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/ra_db/src/input.rs | 23 | ||||
-rw-r--r-- | crates/ra_db/src/lib.rs | 1 |
3 files changed, 21 insertions, 5 deletions
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 82fd842a6..8ab409158 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml | |||
@@ -15,5 +15,5 @@ rustc-hash = "1.1.0" | |||
15 | ra_syntax = { path = "../ra_syntax" } | 15 | ra_syntax = { path = "../ra_syntax" } |
16 | ra_cfg = { path = "../ra_cfg" } | 16 | ra_cfg = { path = "../ra_cfg" } |
17 | ra_prof = { path = "../ra_prof" } | 17 | ra_prof = { path = "../ra_prof" } |
18 | ra_proc_macro = { path = "../ra_proc_macro" } | 18 | ra_tt = { path = "../ra_tt" } |
19 | test_utils = { path = "../test_utils" } | 19 | test_utils = { path = "../test_utils" } |
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 65b553a9f..5ddce98c6 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -10,6 +10,7 @@ use std::{ | |||
10 | fmt, ops, | 10 | fmt, ops, |
11 | path::{Path, PathBuf}, | 11 | path::{Path, PathBuf}, |
12 | str::FromStr, | 12 | str::FromStr, |
13 | sync::Arc, | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | use ra_cfg::CfgOptions; | 16 | use ra_cfg::CfgOptions; |
@@ -19,7 +20,7 @@ use rustc_hash::FxHashSet; | |||
19 | 20 | ||
20 | use crate::{RelativePath, RelativePathBuf}; | 21 | use crate::{RelativePath, RelativePathBuf}; |
21 | use fmt::Display; | 22 | use fmt::Display; |
22 | use ra_proc_macro::ProcMacro; | 23 | use ra_tt::TokenExpander; |
23 | 24 | ||
24 | /// `FileId` is an integer which uniquely identifies a file. File paths are | 25 | /// `FileId` is an integer which uniquely identifies a file. File paths are |
25 | /// messy and system-dependent, so most of the code should work directly with | 26 | /// messy and system-dependent, so most of the code should work directly with |
@@ -117,7 +118,20 @@ impl Display for CrateName { | |||
117 | } | 118 | } |
118 | 119 | ||
119 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] | 120 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] |
120 | pub struct ProcMacroId(pub usize); | 121 | pub struct ProcMacroId(pub u32); |
122 | |||
123 | #[derive(Debug, Clone)] | ||
124 | pub struct ProcMacro { | ||
125 | pub name: SmolStr, | ||
126 | pub expander: Arc<dyn TokenExpander>, | ||
127 | } | ||
128 | |||
129 | impl Eq for ProcMacro {} | ||
130 | impl PartialEq for ProcMacro { | ||
131 | fn eq(&self, other: &ProcMacro) -> bool { | ||
132 | self.name == other.name && Arc::ptr_eq(&self.expander, &other.expander) | ||
133 | } | ||
134 | } | ||
121 | 135 | ||
122 | #[derive(Debug, Clone, PartialEq, Eq)] | 136 | #[derive(Debug, Clone, PartialEq, Eq)] |
123 | pub struct CrateData { | 137 | pub struct CrateData { |
@@ -171,8 +185,11 @@ impl CrateGraph { | |||
171 | cfg_options: CfgOptions, | 185 | cfg_options: CfgOptions, |
172 | env: Env, | 186 | env: Env, |
173 | extern_source: ExternSource, | 187 | extern_source: ExternSource, |
174 | proc_macro: Vec<ProcMacro>, | 188 | proc_macro: Vec<(SmolStr, Arc<dyn ra_tt::TokenExpander>)>, |
175 | ) -> CrateId { | 189 | ) -> CrateId { |
190 | let proc_macro = | ||
191 | proc_macro.into_iter().map(|(name, it)| ProcMacro { name, expander: it }).collect(); | ||
192 | |||
176 | let data = CrateData { | 193 | let data = CrateData { |
177 | root_file_id: file_id, | 194 | root_file_id: file_id, |
178 | edition, | 195 | edition, |
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 5829ae465..a06f59c14 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -15,7 +15,6 @@ pub use crate::{ | |||
15 | FileId, ProcMacroId, SourceRoot, SourceRootId, | 15 | FileId, ProcMacroId, SourceRoot, SourceRootId, |
16 | }, | 16 | }, |
17 | }; | 17 | }; |
18 | pub use ra_proc_macro::ProcMacro; | ||
19 | pub use relative_path::{RelativePath, RelativePathBuf}; | 18 | pub use relative_path::{RelativePath, RelativePathBuf}; |
20 | pub use salsa; | 19 | pub use salsa; |
21 | 20 | ||