aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/lib.rs')
-rw-r--r--crates/ra_hir_expand/src/lib.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index 3c0ef8f1c..5a0e5a19c 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -6,6 +6,9 @@
6 6
7pub mod db; 7pub mod db;
8pub mod ast_id_map; 8pub mod ast_id_map;
9pub mod either;
10pub mod name;
11pub mod hygiene;
9 12
10use std::hash::{Hash, Hasher}; 13use std::hash::{Hash, Hasher};
11 14
@@ -59,17 +62,6 @@ impl HirFileId {
59 } 62 }
60 } 63 }
61 } 64 }
62
63 /// Get the crate which the macro lives in, if it is a macro file.
64 pub fn macro_crate(self, db: &dyn db::AstDatabase) -> Option<CrateId> {
65 match self.0 {
66 HirFileIdRepr::FileId(_) => None,
67 HirFileIdRepr::MacroFile(macro_file) => {
68 let loc = db.lookup_intern_macro(macro_file.macro_call_id);
69 Some(loc.def.krate)
70 }
71 }
72 }
73} 65}
74 66
75#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 67#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]