about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-09-14 22:36:58 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-09-14 22:36:58 +0300
commitf6a5b29d197ba3f64007e51b948b427232173f2f (patch)
treedd5f93cfedc2dfb90f423f9833ed061731e08976
parentca3766e2e58f462a20922e42c821a37eaf0e13db (diff)
downloadrust-f6a5b29d197ba3f64007e51b948b427232173f2f.tar.gz
rust-f6a5b29d197ba3f64007e51b948b427232173f2f.zip
resolve: Tweak some expected/found wording
-rw-r--r--src/librustc_resolve/macros.rs5
-rw-r--r--src/test/ui/issues/issue-49934-errors.rs4
-rw-r--r--src/test/ui/issues/issue-49934-errors.stderr4
3 files changed, 7 insertions, 6 deletions
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index bd8b5e13c62..9096d146451 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -237,7 +237,8 @@ impl<'a> base::Resolver for Resolver<'a> {
                 if let Res::Def(..) = res {
                     self.session.span_err(
                         span,
-                        "expected an inert attribute, found an attribute macro"
+                        &format!("expected an inert attribute, found {} {}",
+                                 res.article(), res.descr()),
                     );
                     return Ok(InvocationRes::Single(self.dummy_ext(kind)));
                 }
@@ -322,7 +323,7 @@ impl<'a> Resolver<'a> {
         self.check_stability_and_deprecation(&ext, path);
 
         Ok(if ext.macro_kind() != kind {
-            let expected = if kind == MacroKind::Attr { "attribute" } else  { kind.descr() };
+            let expected = if kind == MacroKind::Attr { "attribute" } else { kind.descr() };
             let msg = format!("expected {}, found {} `{}`", expected, res.descr(), path);
             self.session.struct_span_err(path.span, &msg)
                         .span_label(path.span, format!("not {} {}", kind.article(), expected))
diff --git a/src/test/ui/issues/issue-49934-errors.rs b/src/test/ui/issues/issue-49934-errors.rs
index 58f64d137b9..6fa5f01ffd9 100644
--- a/src/test/ui/issues/issue-49934-errors.rs
+++ b/src/test/ui/issues/issue-49934-errors.rs
@@ -1,10 +1,10 @@
 fn foo<#[derive(Debug)] T>() {
 //~^ ERROR `derive` may only be applied to structs, enums and unions
-//~| ERROR expected an inert attribute, found an attribute macro
+//~| ERROR expected an inert attribute, found a derive macro
     match 0 {
         #[derive(Debug)]
         //~^ ERROR `derive` may only be applied to structs, enums and unions
-        //~| ERROR expected an inert attribute, found an attribute macro
+        //~| ERROR expected an inert attribute, found a derive macro
         _ => (),
     }
 }
diff --git a/src/test/ui/issues/issue-49934-errors.stderr b/src/test/ui/issues/issue-49934-errors.stderr
index fce1f658812..8778d88d0eb 100644
--- a/src/test/ui/issues/issue-49934-errors.stderr
+++ b/src/test/ui/issues/issue-49934-errors.stderr
@@ -4,7 +4,7 @@ error: `derive` may only be applied to structs, enums and unions
 LL | fn foo<#[derive(Debug)] T>() {
    |        ^^^^^^^^^^^^^^^^
 
-error: expected an inert attribute, found an attribute macro
+error: expected an inert attribute, found a derive macro
   --> $DIR/issue-49934-errors.rs:1:17
    |
 LL | fn foo<#[derive(Debug)] T>() {
@@ -16,7 +16,7 @@ error: `derive` may only be applied to structs, enums and unions
 LL |         #[derive(Debug)]
    |         ^^^^^^^^^^^^^^^^
 
-error: expected an inert attribute, found an attribute macro
+error: expected an inert attribute, found a derive macro
   --> $DIR/issue-49934-errors.rs:5:18
    |
 LL |         #[derive(Debug)]