From ff858376aa4a974cda33a269b4c2d34cbda21bed Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 16 Apr 2021 15:48:03 +0200 Subject: Include path in `unresolved-macro-call` diagnostic --- crates/hir_def/src/nameres/collector.rs | 9 +++++---- crates/hir_def/src/nameres/tests/diagnostics.rs | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'crates/hir_def/src/nameres') diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index fb4ddff5e..05ceb1efb 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -829,7 +829,7 @@ impl DefCollector<'_> { res = ReachedFixedPoint::No; return false; } - Err(UnresolvedMacro) | Ok(Err(_)) => {} + Err(UnresolvedMacro { .. }) | Ok(Err(_)) => {} } } MacroDirectiveKind::Derive { ast_id, derive_attr } => { @@ -845,7 +845,7 @@ impl DefCollector<'_> { res = ReachedFixedPoint::No; return false; } - Err(UnresolvedMacro) => (), + Err(UnresolvedMacro { .. }) => (), } } } @@ -943,10 +943,11 @@ impl DefCollector<'_> { &mut |_| (), ) { Ok(_) => (), - Err(UnresolvedMacro) => { + Err(UnresolvedMacro { path }) => { self.def_map.diagnostics.push(DefDiagnostic::unresolved_macro_call( directive.module_id, ast_id.ast_id, + path, )); } }, @@ -1530,7 +1531,7 @@ impl ModCollector<'_, '_> { )); return; } - Err(UnresolvedMacro) => (), + Err(UnresolvedMacro { .. }) => (), } // Case 2: resolve in module scope, expand during name resolution. diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index 1ac88fc89..543975e07 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs @@ -170,7 +170,7 @@ fn unresolved_legacy_scope_macro() { m!(); m2!(); - //^^^^^^ unresolved macro call + //^^^^^^ unresolved macro `self::m2!` "#, ); } @@ -187,7 +187,7 @@ fn unresolved_module_scope_macro() { self::m!(); self::m2!(); - //^^^^^^^^^^^^ unresolved macro call + //^^^^^^^^^^^^ unresolved macro `self::m2!` "#, ); } -- cgit v1.2.3