diff options
author | Jonas Schievink <[email protected]> | 2021-03-18 14:37:14 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-18 14:37:14 +0000 |
commit | b84efbaacfc980ba167edc145aa7ca5d738448ff (patch) | |
tree | 308ffffd0b61517f13aedad9621430f4c41014e3 /crates/hir_def/src/nameres | |
parent | 816bc7389516dda1eb4821f2ac4d5993cd5611dd (diff) |
Make MacroDefId's `AstId` mandatory when possible
Diffstat (limited to 'crates/hir_def/src/nameres')
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index d0fefb5af..45a79e896 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -357,13 +357,11 @@ impl DefCollector<'_> { | |||
357 | self.exports_proc_macros = true; | 357 | self.exports_proc_macros = true; |
358 | let macro_def = match self.proc_macros.iter().find(|(n, _)| n == name) { | 358 | let macro_def = match self.proc_macros.iter().find(|(n, _)| n == name) { |
359 | Some((_, expander)) => MacroDefId { | 359 | Some((_, expander)) => MacroDefId { |
360 | ast_id: None, | ||
361 | krate: self.def_map.krate, | 360 | krate: self.def_map.krate, |
362 | kind: MacroDefKind::ProcMacro(*expander), | 361 | kind: MacroDefKind::ProcMacro(*expander), |
363 | local_inner: false, | 362 | local_inner: false, |
364 | }, | 363 | }, |
365 | None => MacroDefId { | 364 | None => MacroDefId { |
366 | ast_id: None, | ||
367 | krate: self.def_map.krate, | 365 | krate: self.def_map.krate, |
368 | kind: MacroDefKind::ProcMacro(ProcMacroExpander::dummy(self.def_map.krate)), | 366 | kind: MacroDefKind::ProcMacro(ProcMacroExpander::dummy(self.def_map.krate)), |
369 | local_inner: false, | 367 | local_inner: false, |
@@ -1445,9 +1443,8 @@ impl ModCollector<'_, '_> { | |||
1445 | 1443 | ||
1446 | // Case 2: normal `macro_rules!` macro | 1444 | // Case 2: normal `macro_rules!` macro |
1447 | let macro_id = MacroDefId { | 1445 | let macro_id = MacroDefId { |
1448 | ast_id: Some(ast_id), | ||
1449 | krate: self.def_collector.def_map.krate, | 1446 | krate: self.def_collector.def_map.krate, |
1450 | kind: MacroDefKind::Declarative, | 1447 | kind: MacroDefKind::Declarative(ast_id), |
1451 | local_inner: is_local_inner, | 1448 | local_inner: is_local_inner, |
1452 | }; | 1449 | }; |
1453 | self.def_collector.define_macro(self.module_id, mac.name.clone(), macro_id, is_export); | 1450 | self.def_collector.define_macro(self.module_id, mac.name.clone(), macro_id, is_export); |