Don't confuse the user with notes about tool modules.

This commit is contained in:
Mara Bos 2021-08-22 17:41:22 +02:00
parent 4bd415f70a
commit a13c66e0a5
2 changed files with 5 additions and 13 deletions

View file

@ -971,14 +971,14 @@ impl<'a> Resolver<'a> {
false,
ident.span,
) {
let desc = match binding.macro_kind() {
let res = binding.res();
let desc = match res.macro_kind() {
Some(MacroKind::Bang) => "a function-like macro".to_string(),
Some(MacroKind::Attr) => format!("an attribute: `#[{}]`", ident),
Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident),
None => {
let res = binding.res();
format!("{} {}", res.article(), res.descr())
}
// Don't confuse the user with tool modules.
None if res == Res::ToolMod => continue,
None => format!("{} {}", res.article(), res.descr()),
};
if let crate::NameBindingKind::Import { import, .. } = binding.kind {
if !import.span.is_dummy() {

View file

@ -3,32 +3,24 @@ error: cannot find derive macro `rustfmt` in this scope
|
LL | #[derive(rustfmt)]
| ^^^^^^^
|
= note: `rustfmt` is in scope, but it is a tool module
error: cannot find derive macro `rustfmt` in this scope
--> $DIR/tool-attributes-misplaced-1.rs:4:10
|
LL | #[derive(rustfmt)]
| ^^^^^^^
|
= note: `rustfmt` is in scope, but it is a tool module
error: cannot find attribute `rustfmt` in this scope
--> $DIR/tool-attributes-misplaced-1.rs:9:3
|
LL | #[rustfmt]
| ^^^^^^^
|
= note: `rustfmt` is in scope, but it is a tool module
error: cannot find macro `rustfmt` in this scope
--> $DIR/tool-attributes-misplaced-1.rs:15:5
|
LL | rustfmt!();
| ^^^^^^^
|
= note: `rustfmt` is in scope, but it is a tool module
error[E0573]: expected type, found tool module `rustfmt`
--> $DIR/tool-attributes-misplaced-1.rs:1:10