From c05a1a6e37156b956380d57049a72cfe6f21095d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 18 Mar 2021 16:11:18 +0100 Subject: Store an `AstId` for procedural macros --- crates/hir_expand/src/db.rs | 4 ++-- crates/hir_expand/src/eager.rs | 2 +- crates/hir_expand/src/hygiene.rs | 2 +- crates/hir_expand/src/lib.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/hir_expand/src') diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 4107d7781..2748e25cf 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -157,7 +157,7 @@ fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option None, - MacroDefKind::ProcMacro(expander) => { + MacroDefKind::ProcMacro(expander, ..) => { Some(Arc::new((TokenExpander::ProcMacro(expander), mbe::TokenMap::default()))) } } @@ -269,7 +269,7 @@ fn expand_proc_macro( }; let expander = match loc.def.kind { - MacroDefKind::ProcMacro(expander) => expander, + MacroDefKind::ProcMacro(expander, ..) => expander, _ => unreachable!(), }; diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs index ddadaffd3..04f374a29 100644 --- a/crates/hir_expand/src/eager.rs +++ b/crates/hir_expand/src/eager.rs @@ -209,7 +209,7 @@ fn eager_macro_recur( MacroDefKind::Declarative(_) | MacroDefKind::BuiltIn(..) | MacroDefKind::BuiltInDerive(..) - | MacroDefKind::ProcMacro(_) => { + | MacroDefKind::ProcMacro(..) => { let res = lazy_expand(db, &def, curr.with_value(child.clone()), krate); let val = diagnostic_sink.expand_result_option(res)?; diff --git a/crates/hir_expand/src/hygiene.rs b/crates/hir_expand/src/hygiene.rs index e758b3c0a..20cda1683 100644 --- a/crates/hir_expand/src/hygiene.rs +++ b/crates/hir_expand/src/hygiene.rs @@ -182,7 +182,7 @@ impl HygieneFrame { MacroDefKind::BuiltIn(..) => (info, Some(loc.def.krate), false), MacroDefKind::BuiltInDerive(..) => (info, None, false), MacroDefKind::BuiltInEager(..) => (info, None, false), - MacroDefKind::ProcMacro(_) => (info, None, false), + MacroDefKind::ProcMacro(..) => (info, None, false), } } }, diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 83e11019f..0a379651f 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs @@ -245,7 +245,7 @@ impl MacroDefId { MacroDefKind::BuiltIn(_, id) => id, MacroDefKind::BuiltInDerive(_, id) => id, MacroDefKind::BuiltInEager(_, id) => id, - MacroDefKind::ProcMacro(_) => return None, + MacroDefKind::ProcMacro(..) => return None, }; Some(*id) } @@ -258,7 +258,7 @@ pub enum MacroDefKind { // FIXME: maybe just Builtin and rename BuiltinFnLikeExpander to BuiltinExpander BuiltInDerive(BuiltinDeriveExpander, AstId), BuiltInEager(EagerExpander, AstId), - ProcMacro(ProcMacroExpander), + ProcMacro(ProcMacroExpander, AstId), } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -- cgit v1.2.3