Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs b/crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs
index 5f905de4f1..5ebfe33dab 100644
--- a/crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs
+++ b/crates/ide-diagnostics/src/handlers/unresolved_proc_macro.rs
@@ -1,3 +1,5 @@
+use hir::db::DefDatabase;
+
use crate::{Diagnostic, DiagnosticsContext, Severity};
// Diagnostic: unresolved-proc-macro
@@ -30,10 +32,11 @@ pub(crate) fn unresolved_proc_macro(
None => "proc macro not expanded".to_string(),
};
let severity = if config_enabled { Severity::Error } else { Severity::WeakWarning };
+ let def_map = d.krate.map(|krate| ctx.sema.db.crate_def_map(krate));
let message = format!(
"{message}: {}",
if config_enabled {
- match &d.proc_macro_err {
+ match def_map.as_ref().and_then(|def_map| def_map.proc_macro_loading_error()) {
Some(e) => e,
None => "proc macro not found",
}