about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-06-15 17:34:13 +0200
committerLukas Wirth <lukastw97@gmail.com>2022-06-15 17:34:13 +0200
commit1d34cdcac07b23dafa7826ecf73ce2008b4be479 (patch)
tree95ffe228890cba327b8fa8efaaaaa34c28b2dca3
parent7d51fc4640e1f59b882ff8a8095f4c4f08b80e9e (diff)
downloadrust-1d34cdcac07b23dafa7826ecf73ce2008b4be479.tar.gz
rust-1d34cdcac07b23dafa7826ecf73ce2008b4be479.zip
Diagnose unresolved attribute proc-macros
-rw-r--r--crates/hir-def/src/nameres/collector.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs
index 1c276e0d6f7..46f752f00a4 100644
--- a/crates/hir-def/src/nameres/collector.rs
+++ b/crates/hir-def/src/nameres/collector.rs
@@ -1138,7 +1138,19 @@ impl DefCollector<'_> {
 
                     let def = match resolver(path.clone()) {
                         Some(def) if def.is_attribute() => def,
-                        _ => return true,
+                        _ => {
+                            self.def_map.diagnostics.push(DefDiagnostic::unresolved_proc_macro(
+                                directive.module_id,
+                                MacroCallKind::Attr {
+                                    ast_id,
+                                    attr_args: Default::default(),
+                                    invoc_attr_index: attr.id.ast_index,
+                                    is_derive: false,
+                                },
+                                self.proc_macro_err.clone(),
+                            ));
+                            return true;
+                        }
                     };
                     if matches!(
                         def,