Skip to content

Commit

Permalink
Add regression test for const generics ICE
Browse files Browse the repository at this point in the history
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
  • Loading branch information
varkor and Centril committed May 30, 2019
1 parent c28084a commit 0fdd419
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 0fdd419

Please sign in to comment.