diff options
Diffstat (limited to 'crates/hir_expand/src/lib.rs')
-rw-r--r-- | crates/hir_expand/src/lib.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index ae3086a95..d486186e5 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -145,7 +145,10 @@ impl HirFileId { | |||
145 | let arg_tt = loc.kind.arg(db)?; | 145 | let arg_tt = loc.kind.arg(db)?; |
146 | 146 | ||
147 | let def = loc.def.ast_id.and_then(|id| { | 147 | let def = loc.def.ast_id.and_then(|id| { |
148 | let def_tt = id.to_node(db).token_tree()?; | 148 | let def_tt = match id.to_node(db) { |
149 | ast::Macro::MacroRules(mac) => mac.token_tree()?, | ||
150 | ast::Macro::MacroDef(_) => return None, | ||
151 | }; | ||
149 | Some(InFile::new(id.file_id, def_tt)) | 152 | Some(InFile::new(id.file_id, def_tt)) |
150 | }); | 153 | }); |
151 | 154 | ||
@@ -221,14 +224,8 @@ impl From<EagerMacroId> for MacroCallId { | |||
221 | 224 | ||
222 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 225 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
223 | pub struct MacroDefId { | 226 | pub struct MacroDefId { |
224 | // FIXME: krate and ast_id are currently optional because we don't have a | 227 | pub krate: CrateId, |
225 | // definition location for built-in derives. There is one, though: the | 228 | pub ast_id: Option<AstId<ast::Macro>>, |
226 | // standard library defines them. The problem is that it uses the new | ||
227 | // `macro` syntax for this, which we don't support yet. As soon as we do | ||
228 | // (which will probably require touching this code), we can instead use | ||
229 | // that (and also remove the hacks for resolving built-in derives). | ||
230 | pub krate: Option<CrateId>, | ||
231 | pub ast_id: Option<AstId<ast::MacroRules>>, | ||
232 | pub kind: MacroDefKind, | 229 | pub kind: MacroDefKind, |
233 | 230 | ||
234 | pub local_inner: bool, | 231 | pub local_inner: bool, |