aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db')
-rw-r--r--crates/ra_db/Cargo.toml2
-rw-r--r--crates/ra_db/src/input.rs23
-rw-r--r--crates/ra_db/src/lib.rs1
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"
15ra_syntax = { path = "../ra_syntax" } 15ra_syntax = { path = "../ra_syntax" }
16ra_cfg = { path = "../ra_cfg" } 16ra_cfg = { path = "../ra_cfg" }
17ra_prof = { path = "../ra_prof" } 17ra_prof = { path = "../ra_prof" }
18ra_proc_macro = { path = "../ra_proc_macro" } 18ra_tt = { path = "../ra_tt" }
19test_utils = { path = "../test_utils" } 19test_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
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