File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -560,14 +560,17 @@ impl ExprCollector<'_> {
560
560
// FIXME: do we still need to allocate this as missing ?
561
561
self . alloc_expr ( Expr :: Missing , syntax_ptr)
562
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
566
let macro_call = self . expander . to_source ( AstPtr :: new ( & e) ) ;
564
567
let res = self . expander . enter_expand ( self . db , Some ( & self . body . item_scope ) , e) ;
565
568
566
569
match res. err {
567
570
Some ( ExpandError :: UnresolvedProcMacro ) => {
568
571
self . source_map . diagnostics . push ( BodyDiagnostic :: UnresolvedProcMacro (
569
572
UnresolvedProcMacro {
570
- file : self . expander . current_file_id ,
573
+ file : outer_file ,
571
574
node : syntax_ptr. clone ( ) . into ( ) ,
572
575
precise_location : None ,
573
576
macro_name : None ,
@@ -577,7 +580,7 @@ impl ExprCollector<'_> {
577
580
Some ( err) => {
578
581
self . source_map . diagnostics . push ( BodyDiagnostic :: MacroError (
579
582
MacroError {
580
- file : self . expander . current_file_id ,
583
+ file : outer_file ,
581
584
node : syntax_ptr. clone ( ) . into ( ) ,
582
585
message : err. to_string ( ) ,
583
586
} ,
You can’t perform that action at this time.
0 commit comments