Skip to content

Commit 0fdd419

Browse files
varkorCentril
andcommitted
Add regression test for const generics ICE
Co-Authored-By: Mazdak Farrokhzad <[email protected]>
1 parent c28084a commit 0fdd419

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// run-pass
2+
3+
#![feature(const_generics)]
4+
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
5+
6+
struct Foo<T, const N: usize>([T; {N}]);
7+
8+
impl<T, const N: usize> Foo<T, {N}> {
9+
fn foo(&self) -> usize {
10+
{N}
11+
}
12+
}
13+
14+
fn main() {
15+
let foo = Foo([0u32; 21]);
16+
assert_eq!(foo.0, [0u32; 21]);
17+
assert_eq!(foo.foo(), 21);
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
2+
--> $DIR/const-generic-array-wrapper.rs:3:12
3+
|
4+
LL | #![feature(const_generics)]
5+
| ^^^^^^^^^^^^^^
6+

0 commit comments

Comments
 (0)