Show what things are, but also what they are not.

This commit is contained in:
Mara Bos 2021-08-22 18:15:07 +02:00
parent a13c66e0a5
commit 4e22bf47d0
2 changed files with 14 additions and 8 deletions

View file

@ -978,7 +978,13 @@ impl<'a> Resolver<'a> {
Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident), Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident),
// Don't confuse the user with tool modules. // Don't confuse the user with tool modules.
None if res == Res::ToolMod => continue, 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 let crate::NameBindingKind::Import { import, .. } = binding.kind {
if !import.span.is_dummy() { if !import.span.is_dummy() {

View file

@ -4,7 +4,7 @@ error: cannot find macro `X` in this scope
LL | X!(); 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 --> $DIR/issue-88206.rs:17:35
| |
LL | use hey::{Serialize, Deserialize, X}; LL | use hey::{Serialize, Deserialize, X};
@ -32,7 +32,7 @@ error: cannot find macro `Box` in this scope
LL | Box!(); 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 error: cannot find macro `from_utf8` in this scope
--> $DIR/issue-88206.rs:49:5 --> $DIR/issue-88206.rs:49:5
@ -40,7 +40,7 @@ error: cannot find macro `from_utf8` in this scope
LL | from_utf8!(); 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 --> $DIR/issue-88206.rs:5:5
| |
LL | use std::str::*; LL | use std::str::*;
@ -60,7 +60,7 @@ error: cannot find attribute `from_utf8_unchecked` in this scope
LL | #[from_utf8_unchecked] 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 --> $DIR/issue-88206.rs:5:5
| |
LL | use std::str::*; LL | use std::str::*;
@ -72,7 +72,7 @@ error: cannot find attribute `Deserialize` in this scope
LL | #[Deserialize] 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 --> $DIR/issue-88206.rs:17:22
| |
LL | use hey::{Serialize, Deserialize, X}; 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)] 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 --> $DIR/issue-88206.rs:5:5
| |
LL | use std::str::*; LL | use std::str::*;
@ -104,7 +104,7 @@ error: cannot find derive macro `Serialize` in this scope
LL | #[derive(Serialize)] 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 --> $DIR/issue-88206.rs:17:11
| |
LL | use hey::{Serialize, Deserialize, X}; LL | use hey::{Serialize, Deserialize, X};