about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-08-22 17:26:19 +0200
committerMara Bos <m-ou.se@m-ou.se>2021-08-23 16:57:58 +0200
commit4bd415f70a7af9a64a700772ece354829a777a50 (patch)
treec8aacfd0fb3106893f1f4aefe38e8b8e92ec5610
parent5dea5d7549acbd85f7c2a7b63c8d8aeeb5f6de07 (diff)
downloadrust-4bd415f70a7af9a64a700772ece354829a777a50.tar.gz
rust-4bd415f70a7af9a64a700772ece354829a777a50.zip
Clarify what attribute and derive macros look like.
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs3
-rw-r--r--src/test/ui/issues/issue-11692-2.stderr2
-rw-r--r--src/test/ui/macros/issue-88206.stderr4
-rw-r--r--src/test/ui/macros/macro-path-prelude-fail-3.stderr2
-rw-r--r--src/test/ui/proc-macro/macro-namespace-reserved-2.stderr4
5 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 088596b2cbc..a9e499c9a71 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -973,7 +973,8 @@ impl<'a> Resolver<'a> {
             ) {
                 let desc = match binding.macro_kind() {
                     Some(MacroKind::Bang) => "a function-like macro".to_string(),
-                    Some(kind) => format!("{} {}", kind.article(), kind.descr_expected()),
+                    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())
diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr
index de705e74026..84746ca2c88 100644
--- a/src/test/ui/issues/issue-11692-2.stderr
+++ b/src/test/ui/issues/issue-11692-2.stderr
@@ -4,7 +4,7 @@ error: cannot find macro `test` in this scope
 LL |     concat!(test!());
    |             ^^^^
    |
-   = note: `test` is in scope, but it is an attribute
+   = note: `test` is in scope, but it is an attribute: `#[test]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/macros/issue-88206.stderr b/src/test/ui/macros/issue-88206.stderr
index 9220c16f6ae..c189fc47357 100644
--- a/src/test/ui/macros/issue-88206.stderr
+++ b/src/test/ui/macros/issue-88206.stderr
@@ -16,7 +16,7 @@ error: cannot find macro `test` in this scope
 LL |     test!();
    |     ^^^^
    |
-   = note: `test` is in scope, but it is an attribute
+   = note: `test` is in scope, but it is an attribute: `#[test]`
 
 error: cannot find macro `Copy` in this scope
   --> $DIR/issue-88206.rs:56:5
@@ -24,7 +24,7 @@ error: cannot find macro `Copy` in this scope
 LL |     Copy!();
    |     ^^^^
    |
-   = note: `Copy` is in scope, but it is a derive macro
+   = note: `Copy` is in scope, but it is a derive macro: `#[derive(Copy)]`
 
 error: cannot find macro `Box` in this scope
   --> $DIR/issue-88206.rs:52:5
diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.stderr b/src/test/ui/macros/macro-path-prelude-fail-3.stderr
index 0f448f7cab1..70900a6bc81 100644
--- a/src/test/ui/macros/macro-path-prelude-fail-3.stderr
+++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr
@@ -9,7 +9,7 @@ LL |     inline!();
 LL |     macro_rules! line {
    |     ----------------- similarly named macro `line` defined here
    |
-   = note: `inline` is in scope, but it is an attribute
+   = note: `inline` is in scope, but it is an attribute: `#[inline]`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr
index 3c7ba5ac9ba..633a6c6a0d3 100644
--- a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr
+++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr
@@ -94,7 +94,7 @@ error: cannot find macro `my_macro_attr` in this scope
 LL |     my_macro_attr!();
    |     ^^^^^^^^^^^^^
    |
-   = note: `my_macro_attr` is in scope, but it is an attribute
+   = note: `my_macro_attr` is in scope, but it is an attribute: `#[my_macro_attr]`
 
 error: cannot find macro `MyTrait` in this scope
   --> $DIR/macro-namespace-reserved-2.rs:33:5
@@ -102,7 +102,7 @@ error: cannot find macro `MyTrait` in this scope
 LL |     MyTrait!();
    |     ^^^^^^^
    |
-   = note: `MyTrait` is in scope, but it is a derive macro
+   = note: `MyTrait` is in scope, but it is a derive macro: `#[derive(MyTrait)]`
 
 error: cannot find attribute `my_macro` in this scope
   --> $DIR/macro-namespace-reserved-2.rs:38:3