about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-08-22 17:16:24 +0200
committerMara Bos <m-ou.se@m-ou.se>2021-08-23 16:57:58 +0200
commit5dea5d7549acbd85f7c2a7b63c8d8aeeb5f6de07 (patch)
tree9985c8f8ddb82d57a4021c1c5bd29e989205aa5e /compiler
parentd834d2a7422886890c861e120af5f6a9e9ca9985 (diff)
downloadrust-5dea5d7549acbd85f7c2a7b63c8d8aeeb5f6de07.tar.gz
rust-5dea5d7549acbd85f7c2a7b63c8d8aeeb5f6de07.zip
Say what things are, instead of what they are not.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 60f0ad9e30d..088596b2cbc 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -971,20 +971,19 @@ impl<'a> Resolver<'a> {
                 false,
                 ident.span,
             ) {
-                let it_is = match binding.macro_kind() {
-                    Some(MacroKind::Bang) => "it is a function-like macro".to_string(),
-                    Some(kind) => format!("it is {} {}", kind.article(), kind.descr_expected()),
-                    None => format!(
-                        "it is not {} {}",
-                        macro_kind.article(),
-                        macro_kind.descr_expected()
-                    ),
+                let desc = match binding.macro_kind() {
+                    Some(MacroKind::Bang) => "a function-like macro".to_string(),
+                    Some(kind) => format!("{} {}", kind.article(), kind.descr_expected()),
+                    None => {
+                        let res = binding.res();
+                        format!("{} {}", res.article(), res.descr())
+                    }
                 };
                 if let crate::NameBindingKind::Import { import, .. } = binding.kind {
                     if !import.span.is_dummy() {
                         err.span_note(
                             import.span,
-                            &format!("`{}` is imported here, but {}", ident, it_is),
+                            &format!("`{}` is imported here, but it is {}", ident, desc),
                         );
                         // Silence the 'unused import' warning we might get,
                         // since this diagnostic already covers that import.
@@ -992,7 +991,7 @@ impl<'a> Resolver<'a> {
                         return;
                     }
                 }
-                err.note(&format!("`{}` is in scope, but {}", ident, it_is));
+                err.note(&format!("`{}` is in scope, but it is {}", ident, desc));
                 return;
             }
         }