Skip to content

Bad syntax in macro_rules! macro definition causes an ICE in beta and nightly, but not stable #30669

Closed
@niconii

Description

@niconii

This code:

macro_rules! foo {
    $($t:tt)* => (1);
}

fn main() {
    foo!();
}

gives the following error on 1.5 stable (which is correct, though where it points is perhaps a little odd):

<anon>:6:5: 6:12 error: malformed macro lhs
<anon>:6     foo!();
             ^~~~~~~

but this error on 1.6 beta and the current nightly:

<anon>:6:5: 6:12 error: internal compiler error: malformed macro lhs
<anon>:6     foo!();
             ^~~~~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:175

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions