Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor report of macro_rules! error message #27409

Closed
jnordwick opened this issue Jul 30, 2015 · 0 comments
Closed

Poor report of macro_rules! error message #27409

jnordwick opened this issue Jul 30, 2015 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@jnordwick
Copy link

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.

@sfackler sfackler added A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Jul 31, 2015
bors added a commit that referenced this issue Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

No branches or pull requests

2 participants