From 5322cd830eba39c66650a995af7006c2ef16f925 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 21 Mar 2021 01:45:24 +0100 Subject: Expand legacy-scoped macro during collection --- crates/hir_def/src/nameres/collector.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'crates/hir_def/src/nameres/collector.rs') diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index 46a3c60cd..28b73c3a1 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -1467,12 +1467,13 @@ impl ModCollector<'_, '_> { }, ) { Ok(Ok(macro_call_id)) => { - self.def_collector.unexpanded_macros.push(MacroDirective { - module_id: self.module_id, - ast_id, - legacy: Some(macro_call_id), - depth: self.macro_depth + 1, - }); + // Legacy macros need to be expanded immediately, so that any macros they produce + // are in scope. + self.def_collector.collect_macro_expansion( + self.module_id, + macro_call_id, + self.macro_depth + 1, + ); return; } -- cgit v1.2.3