diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 7b3da373fc9..a6e26d06bb1 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -978,7 +978,13 @@ impl<'a> Resolver<'a> { Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident), // Don't confuse the user with tool modules. None if res == Res::ToolMod => continue, - None => format!("{} {}", res.article(), res.descr()), + None => format!( + "{} {}, not {} {}", + res.article(), + res.descr(), + macro_kind.article(), + macro_kind.descr_expected(), + ), }; if let crate::NameBindingKind::Import { import, .. } = binding.kind { if !import.span.is_dummy() { diff --git a/src/test/ui/macros/issue-88206.stderr b/src/test/ui/macros/issue-88206.stderr index c189fc47357..0413605fdb7 100644 --- a/src/test/ui/macros/issue-88206.stderr +++ b/src/test/ui/macros/issue-88206.stderr @@ -4,7 +4,7 @@ error: cannot find macro `X` in this scope LL | X!(); | ^ | -note: `X` is imported here, but it is a struct +note: `X` is imported here, but it is a struct, not a macro --> $DIR/issue-88206.rs:17:35 | LL | use hey::{Serialize, Deserialize, X}; @@ -32,7 +32,7 @@ error: cannot find macro `Box` in this scope LL | Box!(); | ^^^ | - = note: `Box` is in scope, but it is a struct + = note: `Box` is in scope, but it is a struct, not a macro error: cannot find macro `from_utf8` in this scope --> $DIR/issue-88206.rs:49:5 @@ -40,7 +40,7 @@ error: cannot find macro `from_utf8` in this scope LL | from_utf8!(); | ^^^^^^^^^ | -note: `from_utf8` is imported here, but it is a function +note: `from_utf8` is imported here, but it is a function, not a macro --> $DIR/issue-88206.rs:5:5 | LL | use std::str::*; @@ -60,7 +60,7 @@ error: cannot find attribute `from_utf8_unchecked` in this scope LL | #[from_utf8_unchecked] | ^^^^^^^^^^^^^^^^^^^ | -note: `from_utf8_unchecked` is imported here, but it is a function +note: `from_utf8_unchecked` is imported here, but it is a function, not an attribute --> $DIR/issue-88206.rs:5:5 | LL | use std::str::*; @@ -72,7 +72,7 @@ error: cannot find attribute `Deserialize` in this scope LL | #[Deserialize] | ^^^^^^^^^^^ | -note: `Deserialize` is imported here, but it is a trait +note: `Deserialize` is imported here, but it is a trait, not an attribute --> $DIR/issue-88206.rs:17:22 | LL | use hey::{Serialize, Deserialize, X}; @@ -92,7 +92,7 @@ error: cannot find derive macro `from_utf8_mut` in this scope LL | #[derive(from_utf8_mut)] | ^^^^^^^^^^^^^ | -note: `from_utf8_mut` is imported here, but it is a function +note: `from_utf8_mut` is imported here, but it is a function, not a derive macro --> $DIR/issue-88206.rs:5:5 | LL | use std::str::*; @@ -104,7 +104,7 @@ error: cannot find derive macro `Serialize` in this scope LL | #[derive(Serialize)] | ^^^^^^^^^ | -note: `Serialize` is imported here, but it is a trait +note: `Serialize` is imported here, but it is a trait, not a derive macro --> $DIR/issue-88206.rs:17:11 | LL | use hey::{Serialize, Deserialize, X};