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 when initializing an array in macro expansion #23232

Closed
gkoz opened this issue Mar 9, 2015 · 2 comments
Closed

ICE when initializing an array in macro expansion #23232

gkoz opened this issue Mar 9, 2015 · 2 comments

Comments

@gkoz
Copy link
Contributor

gkoz commented Mar 9, 2015

trait Foo { fn foo(&self); }

macro_rules! foo {
    () => ();
    ($a:expr, $($n:expr,)*) => (
        impl Foo for [(); $a] {
            fn foo(&self) {
                // Okay
                let baz: [i32; $a] = [$($n),*];
                // ICE
                let bar = [$($n),*];
            }
        }
        foo!($($n,)*);
    )
}

foo!(3, 2, 1, 0,);

fn main() {}
<anon>:11:27: 11:36 error: internal compiler error: cat_expr Errd
<anon>:11                 let bar = [$($n),*];
                                    ^~~~~~~~~
rustc 1.0.0-nightly (91bdf23f5 2015-03-09) (built 2015-03-09)
@rprichard
Copy link
Contributor

let bar = []; is enough to make it ICE. This test case does not ICE if I prepend 0, to the bar initializer, so I think this issue is a duplicate of #22897.

@gkoz
Copy link
Contributor Author

gkoz commented Mar 9, 2015

@rprichard
Indeed. I'll close this one then.

@gkoz gkoz closed this as completed Mar 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants