diff options
| author | varkor <github@varkor.com> | 2019-05-30 19:55:43 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-05-30 19:55:43 +0100 |
| commit | 0fdd4191adb998991742c7f63f49b1a6c4e4ec3d (patch) | |
| tree | bf2f3209cd74a815e240b257f39b9ab9040ce3ac /src/test/ui/const-generics/const-generic-array-wrapper.rs | |
| parent | c28084ac16af4ab594b6860958df140e7c876a13 (diff) | |
Add regression test for const generics ICE
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Diffstat (limited to 'src/test/ui/const-generics/const-generic-array-wrapper.rs')
| -rw-r--r-- | src/test/ui/const-generics/const-generic-array-wrapper.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const-generic-array-wrapper.rs b/src/test/ui/const-generics/const-generic-array-wrapper.rs new file mode 100644 index 00000000000..adffe32d67a --- /dev/null +++ b/src/test/ui/const-generics/const-generic-array-wrapper.rs @@ -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); +} |
