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

ICE with macro_rules! inside macro_rules! #10536

Closed
comex opened this issue Nov 18, 2013 · 4 comments
Closed

ICE with macro_rules! inside macro_rules! #10536

comex opened this issue Nov 18, 2013 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@comex
Copy link
Contributor

comex commented Nov 18, 2013

#[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.

@klutzy
Copy link
Contributor

klutzy commented Feb 25, 2014

Still an issue. (revision 6720977)
Similar case:

#[feature(macro_rules)];
fn main() {
    assert!({ macro_rules! bar( () => (5)) });
}

@jbclements jbclements self-assigned this Feb 25, 2014
@jbclements
Copy link
Contributor

Wow! Didn't see this. Thanks for bringing this to my attention.

@erickt
Copy link
Contributor

erickt commented May 10, 2014

visiting for triage. Still reproducible.

@lilyball
Copy link
Contributor

lilyball commented Jul 2, 2014

Trivial reproduction:

pub fn main() {
    assert!({foo! bar})
}

Backtrace is a bit different between this and the macro_rules! nested inside macro_rules!, but both end up failing inside parse_stmt().

@lilyball lilyball added the I-ICE label Jul 2, 2014
lilyball added a commit to lilyball/rust that referenced this issue Jul 2, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 6, 2023
Add suggestions to `extra_unused_type_parameters`

Change the `extra_unused_type_parameters` lint to provide machine applicable suggestions rather than just help messages. Exception to this are cases when any unused type parameters appear bounded in where clauses - for now I've deemed these cases unfixable and separated them out. Future work might be able to provide suggestions in these cases.

Also, added a test case for the `avoid_breaking_exported_api` config option.

r? `@flip1995`

changelog: [`extra_unused_type_parameters`]: Now provides fixable suggestions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants