Show proc-macro loading errors in unresolved-proc-macro diagnostics

This commit is contained in:
Lukas Wirth 2022-06-15 17:33:55 +02:00
parent 15c63c4119
commit 7d51fc4640
14 changed files with 149 additions and 114 deletions

View file

@ -627,7 +627,7 @@ fn emit_def_diagnostic(db: &dyn HirDatabase, acc: &mut Vec<AnyDiagnostic>, diag:
);
}
DefDiagnosticKind::UnresolvedProcMacro { ast } => {
DefDiagnosticKind::UnresolvedProcMacro { ast, proc_macro_err } => {
let (node, precise_location, macro_name, kind) = match ast {
MacroCallKind::FnLike { ast_id, .. } => {
let node = ast_id.to_node(db.upcast());
@ -689,7 +689,16 @@ fn emit_def_diagnostic(db: &dyn HirDatabase, acc: &mut Vec<AnyDiagnostic>, diag:
)
}
};
acc.push(UnresolvedProcMacro { node, precise_location, macro_name, kind }.into());
acc.push(
UnresolvedProcMacro {
node,
precise_location,
macro_name,
kind,
proc_macro_err: proc_macro_err.clone(),
}
.into(),
);
}
DefDiagnosticKind::UnresolvedMacroCall { ast, path } => {
@ -1163,6 +1172,7 @@ impl DefWithBody {
precise_location: None,
macro_name: None,
kind: MacroKind::ProcMacro,
proc_macro_err: None,
}
.into(),
),