Rollup merge of #61344 - varkor:const-failed-to-life-ice, r=Centril

Add regression test for const generics ICE

Closes https://github.com/rust-lang/rust/issues/60879.
This commit is contained in:
Pietro Albini 2019-05-31 13:33:58 +02:00 committed by GitHub
commit 2106d57c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,18 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
struct Foo<T, const N: usize>([T; {N}]);
impl<T, const N: usize> Foo<T, {N}> {
fn foo(&self) -> usize {
{N}
}
}
fn main() {
let foo = Foo([0u32; 21]);
assert_eq!(foo.0, [0u32; 21]);
assert_eq!(foo.foo(), 21);
}

View file

@ -0,0 +1,6 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-generic-array-wrapper.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^