1
Fork 0

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, false,
ident.span, 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::Bang) => "a function-like macro".to_string(),
Some(MacroKind::Attr) => format!("an attribute: `#[{}]`", ident), Some(MacroKind::Attr) => format!("an attribute: `#[{}]`", ident),
Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident), Some(MacroKind::Derive) => format!("a derive macro: `#[derive({})]`", ident),
None => { // Don't confuse the user with tool modules.
let res = binding.res(); None if res == Res::ToolMod => continue,
format!("{} {}", res.article(), res.descr()) None => format!("{} {}", res.article(), res.descr()),
}
}; };
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

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