fix: Fix nested macro diagnostics pointing at macro expansion files

This commit is contained in:
Lukas Wirth 2022-11-19 10:32:32 +01:00
parent 52bc15fc1f
commit dc8254c6ab
4 changed files with 25 additions and 19 deletions

View file

@ -9,10 +9,7 @@ pub(crate) fn unresolved_macro_call(
d: &hir::UnresolvedMacroCall,
) -> Diagnostic {
// Use more accurate position if available.
let display_range = d
.precise_location
.unwrap_or_else(|| ctx.sema.diagnostics_display_range(d.macro_call.clone()).range);
let display_range = ctx.resolve_precise_location(&d.macro_call, d.precise_location);
let bang = if d.is_bang { "!" } else { "" };
Diagnostic::new(
"unresolved-macro-call",