Skip to content

Diagnostics for unimported decl_macro #88634

Closed
@crlf0710

Description

@crlf0710

Currently the error output for this:

#![feature(decl_macro)]

mod foo1 {
    pub macro foo() {}
}

mod foo3 {
    fn bar() {
        foo!();
    }
}

is

error: cannot find macro `foo` in this scope
 --> src/lib.rs:9:9
  |
9 |         foo!();
  |         ^^^
  |
  = note: consider importing this macro:
          crate::foo1::foo

However the "consider importing this macro" part should be
use crate::foo1::foo; to be consistent. (Maybe this change should happen only when decl_macro feature gate is enabled)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions