diff options
author | Edwin Cheng <[email protected]> | 2020-03-26 16:41:44 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-03-26 16:46:40 +0000 |
commit | db162df264a222021dbc7f1f93af94029f3948d9 (patch) | |
tree | 86f91e30f85c2c4f5faa5054b84265ddb64636d5 /crates/ra_db/src | |
parent | 72e68d0caf6e813a19a8d434fb650574b73dbc0a (diff) |
Remove deps on tt_mbe
Diffstat (limited to 'crates/ra_db/src')
-rw-r--r-- | crates/ra_db/src/input.rs | 23 | ||||
-rw-r--r-- | crates/ra_db/src/lib.rs | 1 |
2 files changed, 20 insertions, 4 deletions
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 | ||