Skip to content

Weird error messages when I miss to define macro name. #127612

Closed as not planned
Closed as not planned
@endlesspennier

Description

@endlesspennier

Code

macro_rules! {
    () => {};
}

Current output

error: cannot find macro `macro_rules` in this scope
 --> src/lib.rs:1:1
  |
1 | macro_rules! {
  | ^^^^^^^^^^^
  |

Desired output

error: missing name for `macro_rules!`
 --> src/lib.rs:1:1
  |
1 | macro_rules! {
  | ^^^^^^^^^^^
  |

Rationale and extra context

I am wondering if I should import something to use macro_rules! inside lib.rs.
The error output shows that rust compiler doesn't recognize macro_rules! macro so it should be imported from anywhere else.

Other cases

No response

Rust Version

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-pc-windows-msvc
release: 1.79.0
LLVM version: 18.1.7

Anything else?

No response

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions