about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-10 05:07:53 +0000
committerbors <bors@rust-lang.org>2023-06-10 05:07:53 +0000
commitd0ee1908ed791d3e91d2ad74ba502eaa203cff6d (patch)
tree8715c876352c3cbb2564993a1b1ba51bddca1ee6 /tests/ui
parent29611778b708f95d153fa591a50ac8702dfc0fd5 (diff)
parent5bd8ba84931628fc2fa3e1c75cc9b9762c449125 (diff)
downloadrust-d0ee1908ed791d3e91d2ad74ba502eaa203cff6d.tar.gz
rust-d0ee1908ed791d3e91d2ad74ba502eaa203cff6d.zip
Auto merge of #112452 - MU001999:fix/issue-112439, r=petrochenkov
Make "consider importing" consistent for macros

Fixes #112439
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/empty/empty-macro-use.stderr6
-rw-r--r--tests/ui/hygiene/no_implicit_prelude-2018.stderr6
-rw-r--r--tests/ui/macros/issue-88228.rs5
-rw-r--r--tests/ui/macros/issue-88228.stderr14
-rw-r--r--tests/ui/macros/macro-use-wrong-name.stderr12
-rw-r--r--tests/ui/missing/missing-macro-use.stderr6
-rw-r--r--tests/ui/proc-macro/derive-helper-shadowing.stderr12
7 files changed, 40 insertions, 21 deletions
diff --git a/tests/ui/empty/empty-macro-use.stderr b/tests/ui/empty/empty-macro-use.stderr
index e0b3b8685d6..5d552e4c408 100644
--- a/tests/ui/empty/empty-macro-use.stderr
+++ b/tests/ui/empty/empty-macro-use.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `macro_two` in this scope
 LL |     macro_two!();
    |     ^^^^^^^^^
    |
-   = help: consider importing this macro:
-           two_macros::macro_two
+help: consider importing this macro
+   |
+LL + use two_macros::macro_two;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/hygiene/no_implicit_prelude-2018.stderr b/tests/ui/hygiene/no_implicit_prelude-2018.stderr
index 3f31b041b62..b22f3e75b6f 100644
--- a/tests/ui/hygiene/no_implicit_prelude-2018.stderr
+++ b/tests/ui/hygiene/no_implicit_prelude-2018.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `print` in this scope
 LL |         print!();
    |         ^^^^^
    |
-   = help: consider importing this macro:
-           std::print
+help: consider importing this macro
+   |
+LL +     use std::print;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/macros/issue-88228.rs b/tests/ui/macros/issue-88228.rs
index 60ba2eab7a7..ec55a262509 100644
--- a/tests/ui/macros/issue-88228.rs
+++ b/tests/ui/macros/issue-88228.rs
@@ -1,14 +1,14 @@
 // compile-flags: -Z deduplicate-diagnostics=yes
 // edition:2018
 
-mod hey {
+mod hey { //~ HELP consider importing this derive macro
+    //~^ HELP consider importing this macro
     pub use Copy as Bla;
     pub use std::println as bla;
 }
 
 #[derive(Bla)]
 //~^ ERROR cannot find derive macro `Bla`
-//~| HELP consider importing this derive macro
 struct A;
 
 #[derive(println)]
@@ -19,5 +19,4 @@ struct B;
 fn main() {
     bla!();
     //~^ ERROR cannot find macro `bla`
-    //~| HELP consider importing this macro
 }
diff --git a/tests/ui/macros/issue-88228.stderr b/tests/ui/macros/issue-88228.stderr
index fe8a1deaedd..1dbe2b77be2 100644
--- a/tests/ui/macros/issue-88228.stderr
+++ b/tests/ui/macros/issue-88228.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `bla` in this scope
 LL |     bla!();
    |     ^^^
    |
-   = help: consider importing this macro:
-           crate::hey::bla
+help: consider importing this macro
+   |
+LL + use crate::hey::bla;
+   |
 
 error: cannot find derive macro `println` in this scope
   --> $DIR/issue-88228.rs:14:10
@@ -16,13 +18,15 @@ LL | #[derive(println)]
    = note: `println` is in scope, but it is a function-like macro
 
 error: cannot find derive macro `Bla` in this scope
-  --> $DIR/issue-88228.rs:9:10
+  --> $DIR/issue-88228.rs:10:10
    |
 LL | #[derive(Bla)]
    |          ^^^
    |
-   = help: consider importing this derive macro:
-           crate::hey::Bla
+help: consider importing this derive macro
+   |
+LL + use crate::hey::Bla;
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/macros/macro-use-wrong-name.stderr b/tests/ui/macros/macro-use-wrong-name.stderr
index ca5f0f190e8..36339542ac6 100644
--- a/tests/ui/macros/macro-use-wrong-name.stderr
+++ b/tests/ui/macros/macro-use-wrong-name.stderr
@@ -2,15 +2,21 @@ error: cannot find macro `macro_two` in this scope
   --> $DIR/macro-use-wrong-name.rs:7:5
    |
 LL |     macro_two!();
-   |     ^^^^^^^^^ help: a macro with a similar name exists: `macro_one`
+   |     ^^^^^^^^^
    |
   ::: $DIR/auxiliary/two_macros.rs:2:1
    |
 LL | macro_rules! macro_one { () => ("one") }
    | ---------------------- similarly named macro `macro_one` defined here
    |
-   = help: consider importing this macro:
-           two_macros::macro_two
+help: a macro with a similar name exists
+   |
+LL |     macro_one!();
+   |     ~~~~~~~~~
+help: consider importing this macro
+   |
+LL + use two_macros::macro_two;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/missing/missing-macro-use.stderr b/tests/ui/missing/missing-macro-use.stderr
index 99e291cda03..e1d80f52dad 100644
--- a/tests/ui/missing/missing-macro-use.stderr
+++ b/tests/ui/missing/missing-macro-use.stderr
@@ -4,8 +4,10 @@ error: cannot find macro `macro_two` in this scope
 LL |     macro_two!();
    |     ^^^^^^^^^
    |
-   = help: consider importing this macro:
-           two_macros::macro_two
+help: consider importing this macro
+   |
+LL + use two_macros::macro_two;
+   |
 
 error: aborting due to previous error
 
diff --git a/tests/ui/proc-macro/derive-helper-shadowing.stderr b/tests/ui/proc-macro/derive-helper-shadowing.stderr
index de2c27a878c..7e7870b2951 100644
--- a/tests/ui/proc-macro/derive-helper-shadowing.stderr
+++ b/tests/ui/proc-macro/derive-helper-shadowing.stderr
@@ -16,9 +16,11 @@ error: cannot find attribute `empty_helper` in this scope
 LL |             #[derive(GenHelperUse)]
    |                      ^^^^^^^^^^^^
    |
-   = help: consider importing this attribute macro:
-           empty_helper
    = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider importing this attribute macro
+   |
+LL +             use empty_helper;
+   |
 
 error: cannot find attribute `empty_helper` in this scope
   --> $DIR/derive-helper-shadowing.rs:14:11
@@ -29,9 +31,11 @@ LL |         #[empty_helper]
 LL |             gen_helper_use!();
    |             ----------------- in this macro invocation
    |
-   = help: consider importing this attribute macro:
-           crate::empty_helper
    = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider importing this attribute macro
+   |
+LL +             use crate::empty_helper;
+   |
 
 error[E0659]: `empty_helper` is ambiguous
   --> $DIR/derive-helper-shadowing.rs:26:13