rust icon indicating copy to clipboard operation
rust copied to clipboard

ICE with slice in a generic struct

Open 14427 opened this issue 14 years ago • 4 comments

The following code causes an internal compiler error:

fn foo<T>() {
    let _x: Bar<T> = Bar{ arr: &[] };
}

struct Bar<T> {
    arr: &[T],
}

fn test_foo() {
    foo::<()>();
}

Switching the &[T] to a Option<T> makes it go away.

Backtrace here: https://gist.github.com/3924593

14427 avatar Oct 20 '12 20:10 14427

This test case builds for me on incoming.

brson avatar Oct 22 '12 19:10 brson

Ah, the stage0 compiler does ICE. Maybe we just need to snapshot.

brson avatar Oct 22 '12 19:10 brson

I started a snapshot.

brson avatar Oct 22 '12 21:10 brson

That fixed it.

14427 avatar Oct 23 '12 02:10 14427