Skip to content

ICE with macro_rules! inside macro_rules! #10536

Closed
@comex

Description

@comex
#[feature(macro_rules)];

macro_rules! foo(
    () => (macro_rules! bar(
        () => (5)
    ))
)

fn main() {
    foo!();
}

results in:

task 'rustc' failed at 'not allowed to compare these idents: &ast::Ident{name: 76u, ctxt: 20u}, &ast::Ident{name: 2u, ctxt: 0u}.
                    Probably related to issue #6993', /usr/src/rust/src/libsyntax/ast.rs:50
error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task '<main>' failed at 'explicit failure', /usr/src/rust/src/librustc/lib.rs:396

This works if foo! is used at global scope.

Tested on 2c9e56f.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions