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 macros #5060

Closed
brendanzab opened this issue Feb 20, 2013 · 5 comments
Closed

ICE: with macros #5060

brendanzab opened this issue Feb 20, 2013 · 5 comments
Labels
A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@brendanzab
Copy link
Member

Sorry, couldn't think of a better name for this issue.

macro_rules! print_hd_tl (
    ($field_hd:ident, $($field_tl:ident),+) => ({
        io::print(stringify!($field));
        io::print("::[");
        $(
            io::print(stringify!($field_tl));
            io::print(", ");
        )+
        io::print("]\n");
    })
)

fn main() {
    print_hd_tl!(x, y, z, w)
}

Expected

x::[y, z, w]

Error

$ RUST_LOG=rustc=1,::rt::backtrace rustc print-hd-tl-ice.rs
rust: task failed at 'Key not found in table: &{repr: 44}', /usr/local/src/rust/src/libstd/oldmap.rs:322
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /usr/local/src/rust/src/librustc/rustc.rc:365
rust: domain main @0x7f838a80c210 root task failed
@paulstansifer
Copy link
Contributor

My bet is that stringify! isn't providing the pretty-printer with the correct table of interned identifiers.

@brendanzab
Copy link
Member Author

Woops, I had a typo on line 3. io::print(stringify!($field)); should be io::print(stringify!($field_hd));. Changing this allows it to compile fine. So it looks like an ICE with the error reporting.

@brendanzab
Copy link
Member Author

Oh, and it prints x::[y, z, w, ], but that's a logical error on my part. :)

@graydon
Copy link
Contributor

graydon commented May 1, 2013

assigning bug; change assignment if you disagree

@ghost ghost assigned jbclements May 1, 2013
@catamorphism
Copy link
Contributor

This seems to be fixed. I'll check in a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants