aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-03-26 16:41:44 +0000
committerEdwin Cheng <[email protected]>2020-03-26 16:46:40 +0000
commitdb162df264a222021dbc7f1f93af94029f3948d9 (patch)
tree86f91e30f85c2c4f5faa5054b84265ddb64636d5 /crates/ra_db/src
parent72e68d0caf6e813a19a8d434fb650574b73dbc0a (diff)
Remove deps on tt_mbe
Diffstat (limited to 'crates/ra_db/src')
-rw-r--r--crates/ra_db/src/input.rs23
-rw-r--r--crates/ra_db/src/lib.rs1
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
15use ra_cfg::CfgOptions; 16use ra_cfg::CfgOptions;
@@ -19,7 +20,7 @@ use rustc_hash::FxHashSet;
19 20
20use crate::{RelativePath, RelativePathBuf}; 21use crate::{RelativePath, RelativePathBuf};
21use fmt::Display; 22use fmt::Display;
22use ra_proc_macro::ProcMacro; 23use 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)]
120pub struct ProcMacroId(pub usize); 121pub struct ProcMacroId(pub u32);
122
123#[derive(Debug, Clone)]
124pub struct ProcMacro {
125 pub name: SmolStr,
126 pub expander: Arc<dyn TokenExpander>,
127}
128
129impl Eq for ProcMacro {}
130impl 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)]
123pub struct CrateData { 137pub 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};
18pub use ra_proc_macro::ProcMacro;
19pub use relative_path::{RelativePath, RelativePathBuf}; 18pub use relative_path::{RelativePath, RelativePathBuf};
20pub use salsa; 19pub use salsa;
21 20