From 3bb9efb6b70445076858ab72bebbbd7e31347307 Mon Sep 17 00:00:00 2001 From: Yilin Chen Date: Sun, 21 Mar 2021 23:02:01 +0800 Subject: use the included file as the source of expanded include macro Signed-off-by: Yilin Chen --- crates/hir_expand/src/eager.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'crates/hir_expand/src/eager.rs') diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs index 04f374a29..9eedc8461 100644 --- a/crates/hir_expand/src/eager.rs +++ b/crates/hir_expand/src/eager.rs @@ -124,6 +124,7 @@ pub fn expand_eager_macro( subtree: Arc::new(parsed_args.clone()), krate, call: call_id, + included_file: None, } }); let arg_file_id: MacroCallId = arg_id.into(); @@ -143,9 +144,15 @@ pub fn expand_eager_macro( if let MacroDefKind::BuiltInEager(eager, _) = def.kind { let res = eager.expand(db, arg_id, &subtree); - let (subtree, fragment) = diagnostic_sink.expand_result_option(res)?; - let eager = - EagerCallLoc { def, fragment, subtree: Arc::new(subtree), krate, call: call_id }; + let expanded = diagnostic_sink.expand_result_option(res)?; + let eager = EagerCallLoc { + def, + fragment: expanded.fragment, + subtree: Arc::new(expanded.subtree), + krate, + call: call_id, + included_file: expanded.included_file, + }; Ok(db.intern_eager_expansion(eager)) } else { -- cgit v1.2.3