Skip to content

Commit

Permalink
Rollup merge of rust-lang#61344 - varkor:const-failed-to-life-ice, r=…
Browse files Browse the repository at this point in the history
…Centril

Add regression test for const generics ICE

Closes rust-lang#60879.
  • Loading branch information
Centril committed May 30, 2019
2 parents 30b3139 + 0fdd419 commit 4643a45
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/ui/const-generics/const-generic-array-wrapper.rs
Original file line number Diff line number Diff line change
@@ -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);
}
6 changes: 6 additions & 0 deletions src/test/ui/const-generics/const-generic-array-wrapper.stderr
Original file line number Diff line number Diff line change
@@ -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)]
| ^^^^^^^^^^^^^^

0 comments on commit 4643a45

Please sign in to comment.