Skip to content

Unknown macro variables give "unexpected token" error, not an error that they are unknown #18839

Closed
@huonw

Description

@huonw
#![feature(macro_rules)]

macro_rules! foo { () => { $e }}

fn main() {
    foo!()
}
unknown-macro-variable.rs:3:29: 3:30 error: unexpected token: `$`
unknown-macro-variable.rs:3 macro_rules! foo { () => { $e }}
                                                        ^

This is very confusing and does not provide much help to work out what is wrong. (Looks like this was introduced by 38ce6d9.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions