Skip to content

Badly placed 'Unexpected end of macro invocation' when calling a macro with no arguments #26615

Closed
@thepowersgang

Description

@thepowersgang

When a macro that expects arguments is not passed any, the "unexpected end of macro invocation" message is placed at the start of the crate root file, instead of the invocation.

// Test case

macro_rules! mac {
    ($e:expr) => ("hello");
}

fn main() {
    println!("{}", mac!());
}
<anon>:1:1: 1:1 error: unexpected end of macro invocation
<anon>:1 // Test case
         ^
playpen: application terminated with error code 101

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