Skip to content

Local ambiguity in macro *definition* #28084

@jonas-schievink

Description

@jonas-schievink
macro_rules! m {
    () => ();;
}
<anon>:2:14: 2:15 error: local ambiguity: multiple parsing options: built-in NTs tt ('lhs') or 1 other options.
<anon>:2     () => ();;
                      ^

(the equivalent of $( $lhs:tt => $rhs:tt );+ $(;)* is used to parse macros)

This leaks "lhs", which is an implementation detail, and is a bad error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-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