diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 2c41c0005..689a3274c 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -560,6 +560,9 @@ impl ExprCollector<'_> { | |||
560 | // FIXME: do we still need to allocate this as missing ? | 560 | // FIXME: do we still need to allocate this as missing ? |
561 | self.alloc_expr(Expr::Missing, syntax_ptr) | 561 | self.alloc_expr(Expr::Missing, syntax_ptr) |
562 | } else { | 562 | } else { |
563 | // File containing the macro call. Expansion errors will be attached here. | ||
564 | let outer_file = self.expander.current_file_id; | ||
565 | |||
563 | let macro_call = self.expander.to_source(AstPtr::new(&e)); | 566 | let macro_call = self.expander.to_source(AstPtr::new(&e)); |
564 | let res = self.expander.enter_expand(self.db, Some(&self.body.item_scope), e); | 567 | let res = self.expander.enter_expand(self.db, Some(&self.body.item_scope), e); |
565 | 568 | ||
@@ -567,7 +570,7 @@ impl ExprCollector<'_> { | |||
567 | Some(ExpandError::UnresolvedProcMacro) => { | 570 | Some(ExpandError::UnresolvedProcMacro) => { |
568 | self.source_map.diagnostics.push(BodyDiagnostic::UnresolvedProcMacro( | 571 | self.source_map.diagnostics.push(BodyDiagnostic::UnresolvedProcMacro( |
569 | UnresolvedProcMacro { | 572 | UnresolvedProcMacro { |
570 | file: self.expander.current_file_id, | 573 | file: outer_file, |
571 | node: syntax_ptr.clone().into(), | 574 | node: syntax_ptr.clone().into(), |
572 | precise_location: None, | 575 | precise_location: None, |
573 | macro_name: None, | 576 | macro_name: None, |
@@ -577,7 +580,7 @@ impl ExprCollector<'_> { | |||
577 | Some(err) => { | 580 | Some(err) => { |
578 | self.source_map.diagnostics.push(BodyDiagnostic::MacroError( | 581 | self.source_map.diagnostics.push(BodyDiagnostic::MacroError( |
579 | MacroError { | 582 | MacroError { |
580 | file: self.expander.current_file_id, | 583 | file: outer_file, |
581 | node: syntax_ptr.clone().into(), | 584 | node: syntax_ptr.clone().into(), |
582 | message: err.to_string(), | 585 | message: err.to_string(), |
583 | }, | 586 | }, |