Skip to content

Compiling ambiguous macro invocation hangs forever #5067

Closed
@stevenblenkinsop

Description

@stevenblenkinsop

Trying to compile this code containing an ambiguous macro causes the compiler to hang forever and max out memory:

macro_rules! make_vec(
    (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]);
)

fn main() {
    let _ = make_vec!(a 1, a 2, a 3);
}

rustc 0.5
host: x86_64-apple-darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions