Skip to content

make a help text for 'cannot find macro' actionable #102881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

togami2864
Copy link
Contributor

fix #102601

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 10, 2022
@rust-highfive
Copy link
Contributor

r? @TaKO8Ki

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 10, 2022
@togami2864
Copy link
Contributor Author

I'll fix any other ui tests had forgot to update after reviews.

@rust-log-analyzer

This comment has been minimized.

| ^^^^^^^^
|
= help: consider importing this macro:
use hey::bitflags;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure there's a way to make this into an actual applicable suggestion, instead of just editing the message that this formats. I think that should be done instead of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one question.
As you say, err.span_suggestions() is more appropriate instead of err.help to show a suggestion.
The output will be like this.

help: consider importing this macro
    |
LL  |     use hey::bitflags;
    |

I don't know what to do with the argument Span that I pass to err_suggestions because it is a process in a clause where use_placement_span is None.

if let (IsPattern::Yes, Some(span)) = (is_pattern, use_placement_span){
.....
} else if let Some(span) = use_placement_span {
......
}
else {
         msg.push(':');

          for candidate in accessible_path_strings {
              msg.push('\n');
              msg.push_str(&format!("use {};", &candidate.0));
          }
          err.help(&msg); <- I wanna replace it
      }

https://github.com/togami2864/rust/blob/de66eb0c1831693bac47f088e4eb3fbbf88b15ad/compiler/rustc_resolve/src/diagnostics.rs#L2512-L2552

Do you have any idea or are these any code of similar processing?

@compiler-errors
Copy link
Member

r? compiler-errors i'll take a look at this later

@rustbot rustbot assigned compiler-errors and unassigned TaKO8Ki Dec 15, 2022
@compiler-errors
Copy link
Member

r? @compiler-errors oops 😅

@compiler-errors
Copy link
Member

@togami2864: Disregard my last suggestion about span_suggestions. Seems difficult to do. Please rebase this PR and fix the tests and I can approve.

@togami2864 togami2864 force-pushed the make-help-message-actionable-in-macro branch from de66eb0 to 5c8e3c0 Compare December 20, 2022 12:40
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-13 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
........................................................................................ 4664/14031
........................................................................................ 4752/14031
....................................i................................................... 4840/14031
........................................................................................ 4928/14031
............................F...........................F............................... 5016/14031
........................................................................................ 5192/14031
........................................................................................ 5280/14031
........................................................................................ 5368/14031
........................................................................................ 5456/14031
---
................................................................................ii...... 8096/14031
........................................................................................ 8184/14031
........................................................................................ 8272/14031
........................................................................................ 8360/14031
.....................ii................i..F...i..ii..................................... 8448/14031
........................................................................................ 8624/14031
........................................................................................ 8712/14031
........................................................................................ 8800/14031
...........................................................................i..ii........ 8888/14031
---
........................................................................................ 9944/14031
........................................................................................ 10032/14031
........................................................................................ 10120/14031
........................................................................................ 10208/14031
..............................F.........................F............................... 10296/14031
........................................................................................ 10472/14031
........................................................................................ 10560/14031
........................................................................................ 10648/14031
........................................................................................ 10736/14031
---

---- [ui] src/test/ui/empty/empty-macro-use.rs stdout ----
diff of stderr:

4 LL |     macro_two!();
6    |
-    = note: consider importing this macro:
-            two_macros::macro_two
+    = help: consider importing this macro:
---
To only update this specific test, also pass `--test-args empty/empty-macro-use.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/empty/empty-macro-use.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/empty/empty-macro-use" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/empty/empty-macro-use/auxiliary"
stdout: none
--- stderr -------------------------------
error: cannot find macro `macro_two` in this scope
   |
   |
LL |     macro_two!();
   |
   = help: consider importing this macro:
           use two_macros::macro_two;

---
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
---- [ui] src/test/ui/hygiene/globs.rs stdout ----
diff of stderr:

51 LL |         n!(f);
53    |
-    = note: consider importing this function:
-            foo::f
+    = help: consider importing this function:
---
To only update this specific test, also pass `--test-args hygiene/globs.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/hygiene/globs.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hygiene/globs" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hygiene/globs/auxiliary"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find function `f` in this scope
   |
LL |     pub fn g() {}
LL |     pub fn g() {}
   |     ---------- similarly named function `g` defined here
...
LL |         f(); //~ ERROR cannot find function `f` in this scope
   |
help: a function with a similar name exists
   |
   |
LL |         g(); //~ ERROR cannot find function `f` in this scope
help: consider importing this function
   |
LL | use foo::f;
   |
   |

error[E0425]: cannot find function `g` in this scope
  --> /checkout/src/test/ui/hygiene/globs.rs:15:5
   |
LL |       pub fn f() {}
   |       ---------- similarly named function `f` defined here
...
LL |       g(); //~ ERROR cannot find function `g` in this scope
...
LL | /     m! {
LL | /     m! {
LL | |         use bar::*;
LL | |         g();
LL | |         f(); //~ ERROR cannot find function `f` in this scope
LL | |     }
   |
   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
help: a function with a similar name exists
   |
   |
LL |     f(); //~ ERROR cannot find function `g` in this scope
help: consider importing this function
   |
   |
LL | use bar::g;

error[E0425]: cannot find function `f` in this scope
  --> /checkout/src/test/ui/hygiene/globs.rs:61:12
   |
   |
LL | n!(f);
...
...
LL |         n!(f); //~ ERROR cannot find function `f` in this scope
   |
   = help: consider importing this function:
           use foo::f;
   = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)
   = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0425]: cannot find function `f` in this scope
  --> /checkout/src/test/ui/hygiene/globs.rs:65:17
   |
LL | n!(f);
...
...
LL |                 f //~ ERROR cannot find function `f` in this scope
   |
   = help: consider importing this function:
           use foo::f;
   = note: this error originates in the macro `n` (in Nightly builds, run with -Z macro-backtrace for more info)
---
To only update this specific test, also pass `--test-args hygiene/no_implicit_prelude-2018.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/hygiene/no_implicit_prelude-2018.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hygiene/no_implicit_prelude-2018" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/hygiene/no_implicit_prelude-2018/auxiliary" "--edition=2018"
stdout: none
--- stderr -------------------------------
  --> /checkout/src/test/ui/hygiene/no_implicit_prelude-2018.rs:7:9
   |
   |
LL |         print!(); //~ ERROR cannot find macro `print` in this scope
   |
   = help: consider importing this macro:
           use std::print;

---
error: /checkout/src/test/ui/macros/issue-102601.rs:12: expected help message not found: consider importing this macro:

error: 1 unexpected errors found, 1 expected errors not found
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/macros/issue-102601.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/issue-102601" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/issue-102601/auxiliary"
    Error {
        line_num: 6,
        kind: Some(
            Help,
---

---- [ui] src/test/ui/macros/issue-88228.rs stdout ----
diff of stderr:

4 LL |     bla!();
6    |
-    = note: consider importing this macro:
-            crate::hey::bla
+    = help: consider importing this macro:
+    = help: consider importing this macro:
+            use crate::hey::bla;
10 error: cannot find derive macro `println` in this scope
11   --> $DIR/issue-88228.rs:14:10


21 LL | #[derive(Bla)]
23    |
-    = note: consider importing this derive macro:
-            crate::hey::Bla
+    = help: consider importing this derive macro:
+    = help: consider importing this derive macro:
+            use crate::hey::Bla;
27 error: aborting due to 3 previous errors
28 



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/issue-88228/issue-88228.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args macros/issue-88228.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/macros/issue-88228.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/issue-88228" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/issue-88228/auxiliary" "-Z" "deduplicate-diagnostics=yes" "--edition=2018"
stdout: none
--- stderr -------------------------------
error: cannot find macro `bla` in this scope
   |
   |
LL |     bla!();
   |
   = help: consider importing this macro:
   = help: consider importing this macro:
           use crate::hey::bla;
error: cannot find derive macro `println` in this scope
  --> /checkout/src/test/ui/macros/issue-88228.rs:14:10
   |
   |
LL | #[derive(println)]
   |
   = note: `println` is in scope, but it is a function-like macro


error: cannot find derive macro `Bla` in this scope
   |
   |
LL | #[derive(Bla)]
   |
   = help: consider importing this derive macro:
   = help: consider importing this derive macro:
           use crate::hey::Bla;
error: aborting due to 3 previous errors
------------------------------------------



---- [ui] src/test/ui/macros/macro-use-wrong-name.rs stdout ----
diff of stderr:

9 LL | macro_rules! macro_one { () => ("one") }
10    | ---------------------- similarly named macro `macro_one` defined here
-    = note: consider importing this macro:
-            two_macros::macro_two
+    = help: consider importing this macro:
+            use two_macros::macro_two;
---
To only update this specific test, also pass `--test-args macros/macro-use-wrong-name.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/macros/macro-use-wrong-name.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/macro-use-wrong-name" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/macro-use-wrong-name/auxiliary"
stdout: none
--- stderr -------------------------------
error: cannot find macro `macro_two` in this scope
   |
   |
LL |     macro_two!();
   |     ^^^^^^^^^ help: a macro with a similar name exists: `macro_one`
  ::: /checkout/src/test/ui/macros/auxiliary/two_macros.rs:2:1
   |
   |
LL | macro_rules! macro_one { () => ("one") }
   | ---------------------- similarly named macro `macro_one` defined here
   = help: consider importing this macro:
           use two_macros::macro_two;

error: aborting due to previous error
error: aborting due to previous error
------------------------------------------


---- [ui] src/test/ui/missing/missing-macro-use.rs stdout ----
diff of stderr:

4 LL |     macro_two!();
6    |
-    = note: consider importing this macro:
-            two_macros::macro_two
+    = help: consider importing this macro:
---
To only update this specific test, also pass `--test-args missing/missing-macro-use.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/missing/missing-macro-use.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/missing/missing-macro-use" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/missing/missing-macro-use/auxiliary"
stdout: none
--- stderr -------------------------------
error: cannot find macro `macro_two` in this scope
   |
   |
LL |     macro_two!();
   |
   = help: consider importing this macro:
           use two_macros::macro_two;


error: aborting due to previous error
------------------------------------------


---- [ui] src/test/ui/proc-macro/derive-helper-shadowing.rs stdout ----
diff of stderr:

16 LL |             #[derive(GenHelperUse)]
18    |
-    = note: consider importing this attribute macro:
-            empty_helper
+    = help: consider importing this attribute macro:
+    = help: consider importing this attribute macro:
+            use empty_helper;
21    = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info)
22 
23 error: cannot find attribute `empty_helper` in this scope

29 LL |             gen_helper_use!();
31    |
-    = note: consider importing this attribute macro:
-            crate::empty_helper
+    = help: consider importing this attribute macro:
+    = help: consider importing this attribute macro:
+            use crate::empty_helper;
34    = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info)
35 
36 error[E0659]: `empty_helper` is ambiguous

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/derive-helper-shadowing/derive-helper-shadowing.stderr
To update references, rerun the tests and pass the `--bless` flag
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args proc-macro/derive-helper-shadowing.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/proc-macro/derive-helper-shadowing.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/derive-helper-shadowing" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/derive-helper-shadowing/auxiliary" "--edition=2018"
stdout: none
--- stderr -------------------------------
  --> /checkout/src/test/ui/proc-macro/derive-helper-shadowing.rs:42:15
   |
   |
LL |             #[renamed] //~ ERROR cannot use a derive helper attribute through an import
   |
note: the derive helper attribute imported here
  --> /checkout/src/test/ui/proc-macro/derive-helper-shadowing.rs:41:17
   |
   |
LL |             use empty_helper as renamed;
   |                 ^^^^^^^^^^^^^^^^^^^^^^^

error: cannot find attribute `empty_helper` in this scope
   |
   |
LL |             #[derive(GenHelperUse)] //~ ERROR cannot find attribute `empty_helper` in this scope
   |
   = help: consider importing this attribute macro:
           use empty_helper;
           use empty_helper;
   = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot find attribute `empty_helper` in this scope
   |
   |
LL |         #[empty_helper] //~ ERROR cannot find attribute `empty_helper` in this scope
...
...
LL |             gen_helper_use!();
   |
   = help: consider importing this attribute macro:
           use crate::empty_helper;
           use crate::empty_helper;
   = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0659]: `empty_helper` is ambiguous
   |
   |
LL |         use empty_helper; //~ ERROR `empty_helper` is ambiguous
   |             ^^^^^^^^^^^^ ambiguous name
   |
   = note: ambiguous because of multiple potential import sources
note: `empty_helper` could refer to the derive helper attribute defined here
   |
   |
LL | #[derive(Empty)]
   |          ^^^^^
note: `empty_helper` could also refer to the attribute macro imported here
   |
   |
LL | use test_macros::empty_attr as empty_helper;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: use `crate::empty_helper` to refer to this attribute macro unambiguously

error[E0659]: `empty_helper` is ambiguous
   |
   |
LL | #[empty_helper] //~ ERROR `empty_helper` is ambiguous
   |   ^^^^^^^^^^^^ ambiguous name
   = note: ambiguous because of a name conflict with a derive helper attribute
   = note: ambiguous because of a name conflict with a derive helper attribute
note: `empty_helper` could refer to the derive helper attribute defined here
   |
   |
LL | #[derive(Empty)]
   |          ^^^^^
note: `empty_helper` could also refer to the attribute macro imported here
   |
   |
LL | use test_macros::empty_attr as empty_helper;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: use `crate::empty_helper` to refer to this attribute macro unambiguously
warning: derive helper attribute is used before it is introduced
  --> /checkout/src/test/ui/proc-macro/derive-helper-shadowing.rs:19:3
   |
   |
LL | #[empty_helper] //~ ERROR `empty_helper` is ambiguous
...
...
LL | #[derive(Empty)]
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202>
   = note: `#[warn(legacy_derive_helpers)]` on by default
---

---- [ui] src/test/ui/proc-macro/generate-mod.rs stdout ----
diff of stderr:

4 LL | generate_mod::check!();
6    |
-    = note: consider importing this struct:
-            FromOutside
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use FromOutside;
9    = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info)
11 error[E0412]: cannot find type `Outer` in this scope


14 LL | generate_mod::check!();
16    |
-    = note: consider importing this struct:
-            Outer
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use Outer;
19    = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info)
20 
21 error[E0412]: cannot find type `FromOutside` in this scope

24 LL | #[generate_mod::check_attr]
26    |
-    = note: consider importing this struct:
-            FromOutside
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use FromOutside;
29    = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
31 error[E0412]: cannot find type `OuterAttr` in this scope


34 LL | #[generate_mod::check_attr]
36    |
-    = note: consider importing this struct:
-            OuterAttr
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use OuterAttr;
39    = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
40 
41 error[E0412]: cannot find type `FromOutside` in this scope

44 LL | #[derive(generate_mod::CheckDerive)]
46    |
-    = note: consider importing this struct:
-            FromOutside
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use FromOutside;
49    = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
51 error[E0412]: cannot find type `OuterDerive` in this scope


54 LL | #[derive(generate_mod::CheckDerive)]
56    |
-    = note: consider importing this struct:
-            OuterDerive
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use OuterDerive;
59    = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
60 
61 error[E0412]: cannot find type `FromOutside` in this scope

64 LL |     #[derive(generate_mod::CheckDerive)]
66    |
-    = note: consider importing this struct:
-            FromOutside
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use FromOutside;
69    = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
71 error[E0412]: cannot find type `OuterDerive` in this scope


74 LL |     #[derive(generate_mod::CheckDerive)]
76    |
-    = note: consider importing this struct:
-            OuterDerive
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use OuterDerive;
79    = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
80 
81 error[E0412]: cannot find type `FromOutside` in this scope

84 LL | #[derive(generate_mod::CheckDeriveLint)]
86    |
-    = note: consider importing this struct:
-            FromOutside
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use FromOutside;
89    = note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
91 error[E0412]: cannot find type `OuterDeriveLint` in this scope


94 LL | #[derive(generate_mod::CheckDeriveLint)]
96    |
-    = note: consider importing this struct:
-            OuterDeriveLint
+    = help: consider importing this struct:
+    = help: consider importing this struct:
+            use OuterDeriveLint;
99    = note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
101 error: aborting due to 10 previous errors


The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/generate-mod/generate-mod.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args proc-macro/generate-mod.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/proc-macro/generate-mod.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/generate-mod" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/proc-macro/generate-mod/auxiliary"
stdout: none
--- stderr -------------------------------
error[E0412]: cannot find type `FromOutside` in this scope
   |
   |
LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use FromOutside;
           use FromOutside;
   = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `Outer` in this scope
  --> /checkout/src/test/ui/proc-macro/generate-mod.rs:9:1
   |
   |
LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use Outer;
           use Outer;
   = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0412]: cannot find type `FromOutside` in this scope
   |
   |
LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use FromOutside;
           use FromOutside;
   = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `OuterAttr` in this scope
  --> /checkout/src/test/ui/proc-macro/generate-mod.rs:12:1
   |
   |
LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use OuterAttr;
           use OuterAttr;
   = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0412]: cannot find type `FromOutside` in this scope
   |
   |
LL | #[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use FromOutside;
           use FromOutside;
   = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `OuterDerive` in this scope
  --> /checkout/src/test/ui/proc-macro/generate-mod.rs:16:10
   |
   |
LL | #[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use OuterDerive;
           use OuterDerive;
   = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0412]: cannot find type `FromOutside` in this scope
   |
   |
LL |     #[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use FromOutside;
           use FromOutside;
   = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `OuterDerive` in this scope
  --> /checkout/src/test/ui/proc-macro/generate-mod.rs:21:14
   |
   |
LL |     #[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
   |
   = help: consider importing this struct:
           use OuterDerive;
           use OuterDerive;
   = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0412]: cannot find type `FromOutside` in this scope
   |
   |
LL | #[derive(generate_mod::CheckDeriveLint)] //~  ERROR cannot find type `OuterDeriveLint` in this scope
   |
   = help: consider importing this struct:
           use FromOutside;
           use FromOutside;
   = note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `OuterDeriveLint` in this scope
  --> /checkout/src/test/ui/proc-macro/generate-mod.rs:26:10
   |
   |
LL | #[derive(generate_mod::CheckDeriveLint)] //~  ERROR cannot find type `OuterDeriveLint` in this scope
   |
   = help: consider importing this struct:
           use OuterDeriveLint;
           use OuterDeriveLint;
   = note: this error originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 10 previous errors

For more information about this error, try `rustc --explain E0412`.
------------------------------------------

@Noratrieb Noratrieb added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 27, 2022
@bors
Copy link
Collaborator

bors commented Jan 17, 2023

☔ The latest upstream changes (presumably #106984) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC
Copy link
Member

Dylan-DPC commented Jan 26, 2023

@TOGAMI any updates on this?
Edit: oops sorry wrong ping :D

@togami2864 any updates on this?

@Dylan-DPC
Copy link
Member

Closing this as inactive. Feel free to make a new pr if needed

@Dylan-DPC Dylan-DPC closed this Feb 24, 2023
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show an actionable help text to add a "use ..." on error "cannot find macro"
9 participants