about summary refs log tree commit diff
path: root/src/test/ui/macros
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-08-22 14:06:45 +0200
committerMara Bos <m-ou.se@m-ou.se>2021-08-22 14:07:41 +0200
commitbcc5ecb969579eb1c5fd4df0f7855105b66fe907 (patch)
treec55c6b2719ad48867752d4027b1d36e7427bec3e /src/test/ui/macros
parente7f7fe462a54b1caeb804a974cd43ba9fd7bee5c (diff)
Suggest importing the right kind of macro.
Diffstat (limited to 'src/test/ui/macros')
-rw-r--r--src/test/ui/macros/issue-88228.rs22
-rw-r--r--src/test/ui/macros/issue-88228.stderr26
2 files changed, 48 insertions, 0 deletions
diff --git a/src/test/ui/macros/issue-88228.rs b/src/test/ui/macros/issue-88228.rs
new file mode 100644
index 00000000000..615b865e9f1
--- /dev/null
+++ b/src/test/ui/macros/issue-88228.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Z deduplicate-diagnostics=yes
+// edition:2018
+
+mod hey {
+    pub use Copy as Bla;
+    pub use std::println as bla;
+}
+
+#[derive(Bla)]
+//~^ ERROR cannot find derive macro `Bla`
+//~| NOTE consider importing this derive macro
+struct A;
+
+#[derive(println)]
+//~^ ERROR cannot find derive macro `println`
+struct B;
+
+fn main() {
+    bla!();
+    //~^ ERROR cannot find macro `bla`
+    //~| NOTE consider importing this macro
+}
diff --git a/src/test/ui/macros/issue-88228.stderr b/src/test/ui/macros/issue-88228.stderr
new file mode 100644
index 00000000000..b164e39064c
--- /dev/null
+++ b/src/test/ui/macros/issue-88228.stderr
@@ -0,0 +1,26 @@
+error: cannot find macro `bla` in this scope
+  --> $DIR/issue-88228.rs:19:5
+   |
+LL |     bla!();
+   |     ^^^
+   |
+   = note: consider importing this macro:
+           crate::hey::bla
+
+error: cannot find derive macro `println` in this scope
+  --> $DIR/issue-88228.rs:14:10
+   |
+LL | #[derive(println)]
+   |          ^^^^^^^
+
+error: cannot find derive macro `Bla` in this scope
+  --> $DIR/issue-88228.rs:9:10
+   |
+LL | #[derive(Bla)]
+   |          ^^^
+   |
+   = note: consider importing this derive macro:
+           crate::hey::Bla
+
+error: aborting due to 3 previous errors
+