Skip to content

Poor report of macro_rules! error message #27409

@jnordwick

Description

@jnordwick

rustc 1.3.0-dev (04badd6 2015-07-25)

A macro_rules! syntax error reported at expansion site instead of macro definition:

macro_rules! sum {
    ($h:expr) => $h;
    ($h:expr, $($t:expr),*) =>
        ($h + sum!($($t),*));
}

fn main() {
    let i = sum!(2,3,4);
    println!("{}", i);
}

Error message is:

<anon>:9:13: 9:24 error: macro rhs must be delimited
<anon>:9     let i = sum!(2,3,4);
                     ^~~~~~~~~~~

Where the actual error is in the sum! definition, where $h is undelimited.

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, ..)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions