diff options
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 9ea4e695d..246377100 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -10,7 +10,7 @@ use ra_syntax::{ast, AstNode, Parse, SyntaxNode}; | |||
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
12 | db::{AstDatabase, DefDatabase, InternDatabase}, | 12 | db::{AstDatabase, DefDatabase, InternDatabase}, |
13 | AstId, FileAstId, Module, Source, | 13 | AstId, Crate, FileAstId, Module, Source, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | /// hir makes heavy use of ids: integer (u32) handlers to various things. You | 16 | /// hir makes heavy use of ids: integer (u32) handlers to various things. You |
@@ -121,10 +121,13 @@ impl From<FileId> for HirFileId { | |||
121 | } | 121 | } |
122 | 122 | ||
123 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 123 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
124 | pub struct MacroDefId(pub(crate) AstId<ast::MacroCall>); | 124 | pub struct MacroDefId { |
125 | pub(crate) ast_id: AstId<ast::MacroCall>, | ||
126 | pub(crate) krate: Crate, | ||
127 | } | ||
125 | 128 | ||
126 | pub(crate) fn macro_def_query(db: &impl AstDatabase, id: MacroDefId) -> Option<Arc<MacroRules>> { | 129 | pub(crate) fn macro_def_query(db: &impl AstDatabase, id: MacroDefId) -> Option<Arc<MacroRules>> { |
127 | let macro_call = id.0.to_node(db); | 130 | let macro_call = id.ast_id.to_node(db); |
128 | let arg = macro_call.token_tree()?; | 131 | let arg = macro_call.token_tree()?; |
129 | let (tt, _) = mbe::ast_to_token_tree(&arg).or_else(|| { | 132 | let (tt, _) = mbe::ast_to_token_tree(&arg).or_else(|| { |
130 | log::warn!("fail on macro_def to token tree: {:#?}", arg); | 133 | log::warn!("fail on macro_def to token tree: {:#?}", arg); |