Skip to content

Confusing error when metavariable expressions are used outside of reptitions #96535

Open
@repnop

Description

@repnop

Currently when a metavariable expression is used outside of any repetitions, it produces a somewhat cryptic error message instead of saying its not within a repetitions, example:

#![feature(macro_metavar_expr)]

macro_rules! f {
    ($n:ident) => {
        ${length()};
    }
}

fn main() {
    f!(a);
}
error: length depth must be less than 0
 --> src/main.rs:5:10
  |
5 |         ${length()};
  |          ^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsF-macro_metavar_expr`#![feature(macro_metavar_expr)]`T-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