aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db/src/input.rs')
-rw-r--r--crates/ra_db/src/input.rs23
1 files changed, 20 insertions, 3 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,